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

Public Member Functions

 OpDetDigiAnaDUNE (fhicl::ParameterSet const &)
 
virtual ~OpDetDigiAnaDUNE ()
 
void analyze (art::Event const &)
 
- 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

std::string fInputModule
 
std::string fInstanceName
 
double fSampleFreq
 
bool fAnaTree_SSPLED
 
int fMaxEvents
 
int fNEvents
 
std::vector< double > wf_start
 
std::vector< int > canal_op
 
std::vector< double > wf_inicio
 
std::vector< double > wf_end
 
std::vector< int > wf_size
 
TTree * arvore
 

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 45 of file OpDetDigiAnaDUNE_module.cc.

Constructor & Destructor Documentation

opdet::OpDetDigiAnaDUNE::OpDetDigiAnaDUNE ( fhicl::ParameterSet const &  pset)

Definition at line 90 of file OpDetDigiAnaDUNE_module.cc.

91  : EDAnalyzer(pset)
92  , fInputModule { pset.get< std::string >("InputModule") }
93  , fInstanceName { pset.get< std::string >("InstanceName") }
94  , fAnaTree_SSPLED { pset.get< bool >("SSP_LED_AnaTree") }
95  , fMaxEvents { pset.get< int >("MaxEvents", -1) }
96  , fNEvents { 0 }
97 
98  {
99 
100  // Read the fcl-file
101  // Obtain parameters from DetectorClocksService
102  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataForJob();
103  fSampleFreq = clockData.OpticalClock().Frequency();
104 
106 
107 // std::cout<<"Valor bool = "<<fAnaTree_SSPLED<<std::endl;
108 
109  if(fAnaTree_SSPLED){
110  arvore = tfs->make<TTree>("TriggerData","TriggerInfo");
111  arvore->Branch("OpticalCh",&canal_op);
112  arvore->Branch("WfFirstTime",&wf_inicio);
113  arvore->Branch("WfSize",&wf_size);
114  arvore->Branch("Trg_PreTrg",&wf_start);
115  arvore->Branch("WfEnd",&wf_end);
116  }
117 
118  }
std::vector< double > wf_end
std::vector< double > wf_start
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< double > wf_inicio
opdet::OpDetDigiAnaDUNE::~OpDetDigiAnaDUNE ( )
virtual

Definition at line 122 of file OpDetDigiAnaDUNE_module.cc.

123  {
124  }

Member Function Documentation

void opdet::OpDetDigiAnaDUNE::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 127 of file OpDetDigiAnaDUNE_module.cc.

128  {
129  // Quick exit if not filling tree
130  if (fMaxEvents > 0 && fNEvents > fMaxEvents && !fAnaTree_SSPLED) return;
131 
132  // Map to store how many waveforms are on one optical channel
133  std::map< int, int > mapChannelWF;
134 
135  // Get OpDetWaveforms from the event
137  auto waveformHandle = evt.getHandle< std::vector< raw::OpDetWaveform > >(itag1);
138 
139  // Access ART's TFileService, which will handle creating and writing
140  // histograms for us
142 
143 
144  double firstWaveformTime = -9999;
145 
146  for (auto const& waveform : *waveformHandle)
147  {
148  if (firstWaveformTime < 0) firstWaveformTime = waveform.TimeStamp();
149  }
150 
151 
152  if (fNEvents < 10) {
153  std::cout << "Event #" << evt.id().event() << ", firstTime: " << firstWaveformTime << std::endl;
154  }
155 
156  for (auto const& waveform : *waveformHandle)
157  {
158 
159  int channel = waveform.ChannelNumber();
160 
161  // Implement different end time for waveforms of variable length
162  double startTime = waveform.TimeStamp() - firstWaveformTime;
163  double endTime = double(waveform.size())/fSampleFreq + startTime;
164 
165  if(fAnaTree_SSPLED){
166  canal_op.emplace_back(channel);
167  wf_inicio.emplace_back(firstWaveformTime);
168  wf_start.emplace_back(startTime);
169  wf_end.emplace_back(endTime);
170  wf_size.emplace_back(waveform.size());
171  }
172 
173  // Skip if past max number of events requested
174  if (fMaxEvents > 0 && fNEvents > fMaxEvents) continue;
175 
176  // Make a name for the histogram
177  std::stringstream histName;
178  histName << "event_" << evt.id().event()
179  << "_opchannel_" << channel
180  << "_waveform_" << mapChannelWF[channel];
181  // Increase counter for number of waveforms on this optical channel
182  mapChannelWF[channel]++;
183  // Create a new histogram
184  TH1D *waveformHist = tfs->make< TH1D >(histName.str().c_str(),
185  TString::Format(";t - %f (#mus);",firstWaveformTime),
186  waveform.size(), startTime, endTime);
187 
188  // Copy values from the waveform into the histogram
189  for (size_t tick = 0; tick < waveform.size(); tick++){
190  waveformHist->SetBinContent(tick + 1, waveform[tick]);
191  }
192  }
193 
194  if(fAnaTree_SSPLED){
195  arvore->Fill();
196  canal_op.clear();
197  wf_inicio.clear();
198  wf_start.clear();
199  wf_end.clear();
200  wf_size.clear();
201  }
202 
203  ++fNEvents;
204  }
std::vector< double > wf_end
std::vector< double > wf_start
unsigned int event
Definition: DataStructs.h:636
Format
Definition: utils.h:7
uint8_t channel
Definition: CRTFragment.hh:201
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
std::vector< double > wf_inicio
TCEvent evt
Definition: DataStructs.cxx:7
QTextStream & endl(QTextStream &s)

Member Data Documentation

TTree* opdet::OpDetDigiAnaDUNE::arvore
private

Definition at line 72 of file OpDetDigiAnaDUNE_module.cc.

std::vector<int> opdet::OpDetDigiAnaDUNE::canal_op
private

Definition at line 68 of file OpDetDigiAnaDUNE_module.cc.

bool opdet::OpDetDigiAnaDUNE::fAnaTree_SSPLED
private

Definition at line 62 of file OpDetDigiAnaDUNE_module.cc.

std::string opdet::OpDetDigiAnaDUNE::fInputModule
private

Definition at line 59 of file OpDetDigiAnaDUNE_module.cc.

std::string opdet::OpDetDigiAnaDUNE::fInstanceName
private

Definition at line 60 of file OpDetDigiAnaDUNE_module.cc.

int opdet::OpDetDigiAnaDUNE::fMaxEvents
private

Definition at line 63 of file OpDetDigiAnaDUNE_module.cc.

int opdet::OpDetDigiAnaDUNE::fNEvents
private

Definition at line 64 of file OpDetDigiAnaDUNE_module.cc.

double opdet::OpDetDigiAnaDUNE::fSampleFreq
private

Definition at line 61 of file OpDetDigiAnaDUNE_module.cc.

std::vector<double> opdet::OpDetDigiAnaDUNE::wf_end
private

Definition at line 70 of file OpDetDigiAnaDUNE_module.cc.

std::vector<double> opdet::OpDetDigiAnaDUNE::wf_inicio
private

Definition at line 69 of file OpDetDigiAnaDUNE_module.cc.

std::vector<int> opdet::OpDetDigiAnaDUNE::wf_size
private

Definition at line 71 of file OpDetDigiAnaDUNE_module.cc.

std::vector<double> opdet::OpDetDigiAnaDUNE::wf_start
private

Definition at line 67 of file OpDetDigiAnaDUNE_module.cc.


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