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

Public Member Functions

 OpDigiAna (const fhicl::ParameterSet &)
 
void analyze (const art::Event &)
 
- 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
 
float fSampleFreq
 
float fTimeBegin
 
float fTimeEnd
 
float fZeroSupThresh
 
double fSPEAmp
 
bool fMakeBipolarHist
 
bool fMakeUnipolarHist
 

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 29 of file OpDigiAna_module.cc.

Constructor & Destructor Documentation

opdet::OpDigiAna::OpDigiAna ( const fhicl::ParameterSet )

Definition at line 67 of file OpDigiAna_module.cc.

68  : EDAnalyzer(pset)
69  {
70 
72  fSPEAmp = odp->GetSPECumulativeAmplitude();
73  fTimeBegin = odp->TimeBegin();
74  fTimeEnd = odp->TimeEnd();
75  fSampleFreq = odp->SampleFreq();
76 
77 
78  // Indicate that the Input Module comes from .fcl
79  fInputModule = pset.get<std::string>("InputModule");
80  fInstanceName = pset.get<std::string>("InstanceName");
81  fZeroSupThresh = pset.get<double>("ZeroSupThresh") * fSPEAmp;
82 
83  fMakeBipolarHist = pset.get<bool>("MakeBipolarHist");
84  fMakeUnipolarHist = pset.get<bool>("MakeUnipolarHist");
85 
86 
87  }
std::string fInputModule
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::string fInstanceName

Member Function Documentation

void opdet::OpDigiAna::analyze ( const art::Event evt)

Definition at line 90 of file OpDigiAna_module.cc.

91  {
92 
93  // Create a handle for our vector of pulses
95 
96  // Create string for histogram name
97  char HistName[50];
98 
99 
100  // Read in WaveformHandle
101  evt.getByLabel(fInputModule, fInstanceName, WaveformHandle);
102 
103  // Access ART's TFileService, which will handle creating and writing
104  // histograms for us.
106 
107 
108  std::vector<std::string> histnames;
109 
110  // For every OpDet waveform in the vector given by WaveformHandle
111  for(unsigned int i = 0; i < WaveformHandle->size(); ++i)
112  {
113  // Get OpDetPulse
114  art::Ptr< raw::OpDetPulse > ThePulsePtr(WaveformHandle, i);
115  raw::OpDetPulse ThePulse = *ThePulsePtr;
116 
117  // Make an instance of histogram and its pointer, changing all units to ns
118  // Notice that histogram axis is in ns but binned by 1/64MHz;
119  // appropriate conversions are made from beginning and end time
120  // in us, and frequency in MHz.
121 
122  // Make sure the histogram name is unique since there can be multiple pulses
123  // per event and photo detector
124  unsigned int pulsenum = 0;
125  while (true) {
126  sprintf(HistName, "Event_%d_OpDet_%i_Pulse_%i", evt.id().event(), ThePulse.OpChannel(), pulsenum);
127  auto p = std::find(histnames.begin(), histnames.end(), HistName);
128  if ( p != histnames.end() ) {
129  // Found a duplicate
130  pulsenum++;
131  }
132  else {
133  // Found a unique name
134  histnames.push_back(HistName);
135  break;
136  }
137  }
138 
139 
140 
141  TH1D* PulseHist = nullptr;
142  if(fMakeBipolarHist)
143  {
144  PulseHist= tfs->make<TH1D>(HistName, ";t (ns);",
146  fTimeBegin * 1000.,
147  fTimeEnd * 1000.);
148  }
149 
150  sprintf(HistName, "Event_%d_uni_OpDet_%i_Pulse_%i", evt.id().event(), ThePulse.OpChannel(), pulsenum);
151  TH1D* UnipolarHist = nullptr;
153  {
154  UnipolarHist= tfs->make<TH1D>(HistName, ";t (ns);",
156  fTimeBegin * 1000.,
157  fTimeEnd * 1000.);
158  }
159 
160  for(unsigned int binNum = 0; binNum < ThePulse.Waveform().size(); ++binNum)
161  {
162  // Fill histogram with waveform
163 
164  if(fMakeBipolarHist) PulseHist->SetBinContent( binNum,
165  (double) ThePulse.Waveform()[binNum] );
166  if((binNum>0)&&(fMakeUnipolarHist))
167  {
168  double BinContent = (double) ThePulse.Waveform()[binNum] +
169  (double) UnipolarHist->GetBinContent(binNum-1);
170  if(BinContent>fZeroSupThresh)
171  UnipolarHist->SetBinContent(binNum,BinContent);
172  else
173  UnipolarHist->SetBinContent(binNum,0);
174 
175  }
176 
177  }
178 
179  }
180  }
std::string fInputModule
unsigned short OpChannel() const
Definition: OpDetPulse.h:61
const std::vector< short > & Waveform() const
Definition: OpDetPulse.h:59
std::string fInstanceName
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
p
Definition: test.py:223
EventNumber_t event() const
Definition: EventID.h:116
Definition: fwd.h:31
EventID id() const
Definition: Event.cc:34

Member Data Documentation

std::string opdet::OpDigiAna::fInputModule
private

Definition at line 46 of file OpDigiAna_module.cc.

std::string opdet::OpDigiAna::fInstanceName
private

Definition at line 47 of file OpDigiAna_module.cc.

bool opdet::OpDigiAna::fMakeBipolarHist
private

Definition at line 56 of file OpDigiAna_module.cc.

bool opdet::OpDigiAna::fMakeUnipolarHist
private

Definition at line 57 of file OpDigiAna_module.cc.

float opdet::OpDigiAna::fSampleFreq
private

Definition at line 48 of file OpDigiAna_module.cc.

double opdet::OpDigiAna::fSPEAmp
private

Definition at line 54 of file OpDigiAna_module.cc.

float opdet::OpDigiAna::fTimeBegin
private

Definition at line 49 of file OpDigiAna_module.cc.

float opdet::OpDigiAna::fTimeEnd
private

Definition at line 50 of file OpDigiAna_module.cc.

float opdet::OpDigiAna::fZeroSupThresh
private

Definition at line 52 of file OpDigiAna_module.cc.


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