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

Public Member Functions

 ICEBERGPDSSPMonitor (fhicl::ParameterSet const &pset)
 
 ICEBERGPDSSPMonitor (ICEBERGPDSSPMonitor const &)=delete
 
 ICEBERGPDSSPMonitor (ICEBERGPDSSPMonitor &&)=delete
 
ICEBERGPDSSPMonitoroperator= (ICEBERGPDSSPMonitor const &)=delete
 
ICEBERGPDSSPMonitoroperator= (ICEBERGPDSSPMonitor &&)=delete
 
void analyze (art::Event const &evt) override
 
- 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 fOpDetWaveformModuleLabel
 
std::string fOpHitModuleLabel
 
double fSampleFreq
 
std::map< int, TH1D * > avgWaveforms
 
std::map< int, int > countWaveform
 
std::map< size_t, TH2D * > persistent_waveform_
 
std::map< size_t, TH2D * > Waveforms
 
std::map< int, TH1F * > maxadchist
 
std::map< int, int > ADC
 
std::map< int, int > maxadc
 
std::map< int, int > threshold
 
std::map< int, int >::iterator adcit
 
std::map< int, int >::iterator itr
 
std::map< int, int >::iterator i
 
art::ServiceHandle< art::TFileService > tfs
 
TTree * fADCTree
 
Float_t fmaxadc3
 
Float_t fmaxadc7
 
Float_t fdistpe
 
Float_t fpedestal
 
Float_t fthres3
 
Float_t fthres7
 
Float_t fpe3
 
Float_t fpe7
 
Float_t fadc3
 
Float_t fadc7
 
float fbaseline3
 
float fbaseline7
 
std::vector< Int_t > fadcval7
 
std::vector< Int_t > fadcval3
 

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 52 of file ICEBERGPDSSPMonitor_module.cc.

Constructor & Destructor Documentation

icebergpd::ICEBERGPDSSPMonitor::ICEBERGPDSSPMonitor ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 122 of file ICEBERGPDSSPMonitor_module.cc.

123  : EDAnalyzer{pset} // ,
124  // More initializers here.
125 {
126  // Call appropriate consumes<>() for any products to be retrieved by this module.
127  fOpDetWaveformModuleLabel = pset.get<std::string>("OpDetWaveformLabel");
128  fOpHitModuleLabel = pset.get<std::string>("OpHitLabel");
129 
130  fADCTree = tfs->make<TTree>("ADCTree","ADCTree");
131  fADCTree->Branch("Channel7", &fmaxadc7, "Channel7/F");
132  fADCTree->Branch("Channel3", &fmaxadc3, "Channel3/F");
133  fADCTree->Branch("distpe", &fdistpe, "distpe/F");
134  fADCTree->Branch("pedestal", &fpedestal, "pedestal/F");
135  fADCTree->Branch("thres3", &fthres3, "thres3/F");
136  fADCTree->Branch("thres7", &fthres7, "thres7/F");
137  fADCTree->Branch("PE7", &fpe7, "PE7/F");
138  fADCTree->Branch("PE3", &fpe3, "PE3/F");
139  fADCTree->Branch("ADC7", &fadc7, "ADC7/F");
140  fADCTree->Branch("ADC3", &fadc3, "ADC3/F");
141  fADCTree->Branch("Baseline3", &fbaseline3, "Baseline3/F");
142  fADCTree->Branch("Baseline7", &fbaseline7, "Baseline7/F");
143  fADCTree->Branch("adcval7", &fadcval7);
144  fADCTree->Branch("adcval3", &fadcval3);
145 }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
art::ServiceHandle< art::TFileService > tfs
icebergpd::ICEBERGPDSSPMonitor::ICEBERGPDSSPMonitor ( ICEBERGPDSSPMonitor const &  )
delete
icebergpd::ICEBERGPDSSPMonitor::ICEBERGPDSSPMonitor ( ICEBERGPDSSPMonitor &&  )
delete

Member Function Documentation

void icebergpd::ICEBERGPDSSPMonitor::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 147 of file ICEBERGPDSSPMonitor_module.cc.

148 {
149 
150  // Get Ophit from the event
151  auto OpHitHandle = evt.getHandle< std::vector< recob::OpHit > >(fOpHitModuleLabel);
152 
153  // Get OpDetWaveforms from the event
154  auto OpDetWaveformHandle = evt.getHandle< std::vector< raw::OpDetWaveform > >(fOpDetWaveformModuleLabel);
155 
156  // std::cout<< "Event #" << evt.id().event() <<"\t" << OpDetWaveformHandle->size() << std::endl;
157 
158  // Obtain parameters from DetectorClocksService
159  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
160  fSampleFreq = clockData.OpticalClock().Frequency();
161 
162  int n = 0; int ntick = 0; int three = 0; int seven = 0;// float adc = 0;
163  long int adcmax = 0; long int adcval = 0; long int adcval3 = 0, adcval7 = 0, sig_adcval3 = 0, sig_adcval7 = 0;
164 
165  double sumthres7 = 0, pedist3 = 0, pedist7 = 0, thres = 0, thres3 = 0, thres7 = 0;
166  maxadc[3] = 0.0;
167  maxadc[7] = 0.0;
168  for (size_t i = 0; i < OpDetWaveformHandle->size(); i++)
169  {
170  // This was probably required to overcome the "const" problem
171  // with OpDetPulse::Waveform()
172  art::Ptr< raw::OpDetWaveform > waveformPtr(OpDetWaveformHandle, i);
173  // raw::OpDetWaveform pulse = *waveformPtr;
174 
175  int channel = waveformPtr->ChannelNumber();
176  //std::cout<< "channel # -------" << channel << std::endl;
177  if (channel ==3) three++;
178  if (channel ==7) seven++;
179  // channel 3 is S-ARAPUCA and channel 7 is X-ARAPUCA
180  if(channel != 3 && channel != 7) continue;
181  //if(channel != 3) continue;
182  // std::cout<< "Event #" << evt.id().event() << "\t ............"<<std::endl;
183 
184 
185  /*
186  // Create the TH1 if it doesn't exist
187  if (avgWaveforms.find(channel) == avgWaveforms.end() ) {
188  TString histName = TString::Format("avgwaveform_channel_%03i", channel);
189  avgWaveforms[channel] = tfs->make< TH1D >(histName, ";t (us);", waveformPtr->size(), 0, double(waveformPtr->size()) / fSampleFreq);
190  // avgWaveforms[channel] = tfs->make< TH1D >(histName, ";time sample;", waveformPtr->size(), 0, double(waveformPtr->size()));
191  }
192  // Add this waveform to this histogram
193  for (size_t tick = 0; tick < waveformPtr->size(); tick++) {
194  avgWaveforms[channel]->Fill(double(tick)/fSampleFreq, waveformPtr->at(tick));
195  //avgWaveforms[channel]->Fill(waveformPtr->at(tick));
196  }
197  */
198 
199  // Count number of waveforms on each channel
201 
202 
203  if (Waveforms.find(channel) == Waveforms.end())
204  {
205  //TString histName = TString::Format("waveform_channel_%03i", channel);
206  Waveforms[channel] = tfs->make<TH2D>(Form("waveform_%d",channel),Form("waveform_%d",channel), 2000,0,2000, 20000, 0, 20000);
207  //pwave->SetTitle(Form("Persistent waveform - Channel %d",channel));
208  // pwave->GetYaxis()->SetTitle("ADC value");
209  // pwave->GetXaxis()->SetTitle("Time sample");
210  // persistent_waveform_[channel] = pwave;
211  // std::cout << persistent_waveform_.find(channel)->second << std::endl;
212  }
213 
214 
215 
216  for (size_t tick = 0; tick < waveformPtr->size(); tick++) {
217  //avgWaveforms[channel]->Fill(double(tick)/fSampleFreq, waveformPtr->at(tick));
218  Waveforms[channel]->Fill(tick+1, waveformPtr->at(tick));
219  adcval = waveformPtr->at(tick);
220  ADC[channel] = adcval;
221  adcmax = std::max(adcmax, adcval);
222 
223  if (channel == 3) {
224  fadcval3 .emplace_back(waveformPtr->at(tick));
225  if (tick <= 700){thres += adcval; n++; adcval3 = waveformPtr->at(tick) - 1587;
226  thres3 += adcval3;
227  }
228  if (tick < 1300 && tick > 790){
229  sig_adcval3 = waveformPtr->at(tick) - 1587;
230  pedist3 += sig_adcval3;}}
231  // if (channel == 3) {
232  //if (adcval < 1586) continue;
233  //}
234 
235  if (channel == 7) {
236  fadcval7 .emplace_back(waveformPtr->at(tick));
237  if (tick <= 700){sumthres7 += adcval; ntick++; adcval7 = waveformPtr->at(tick) - 1524; thres7 += adcval7;}//if (adcval < 1586) continue;
238  if (tick < 1300 && tick > 790){
239  sig_adcval7 = waveformPtr->at(tick) -1524;
240  pedist7 += sig_adcval7;}}
241  //}
242  // std::cout << "adcvalue \t"<< adcval <<"\t adcmax \t"<< adcmax <<std::endl;
243 
244  }
245 
246  //if (channel == 3)
247  fthres3 = thres3;
248  //if (channel == 7)
249  fthres7 = thres7;
250 // std::cout <<"\t thres3 \t"<< thres3 <<std::endl;
251  fpe3 = pedist3;
252  fpe7 = pedist7;
253  fbaseline3 = thres/n;
254  fbaseline7 = sumthres7/ntick;
255 
256 
257 
258  // std::cout << "Event #" << evt.id().event() <<"\t" << n << "\t"<< thres <<"\t"<< thres/n <<std::endl;
259  if (maxadchist.find(channel) == maxadchist.end()){
260  TString histname = TString::Format("Maxadc_channel_%03i", channel);
261  maxadchist[channel] = tfs->make<TH1F>(histname,";Maximum ADC; Events", 50, 0,20000);
262  }
263 
264  maxadchist[channel]->Fill(adcmax);
265 
266  for (adcit = ADC.begin(); adcit != ADC.end(); ++adcit) {
267  //std::cout << '\t' << adcit->first
268  // << '\t' << adcit->second << std::endl;
269  if (adcit->first == 3 ) fadc3 = adcit->second;
270  if (adcit->first == 7 ) fadc7 = adcit->second;
271  }
272 
273  maxadc[channel] = adcmax;
274  //threshold[channel] = thres;
275  //PEdist[channel] = pedist;
276 
277  //std::cout<<channel<<
278  // smear->Fill( maxadc(3).second, maxadc(7).second);
279  //
280 
281 
282 
283  // std::cout<< "Event #........." << evt.id().event() <<"\t" << OpDetWaveformHandle->size() << "\t"<<channel<< std::endl;
284  }
285  // fdistpe = pedist;
286  //fpedestal = sumthres;
287  // std::cout << sumthres << "\t" << pedist <<std::endl;
288  for (itr = maxadc.begin(); itr != maxadc.end(); ++itr) {
289  // std::cout << '\t' << itr->first
290  // << '\t' << itr->second << std::endl;
291  if (itr->first == 3 ) fmaxadc3 = itr->second;
292  if (itr->first == 7 ) fmaxadc7 = itr->second;
293  }
294 
295 
296 
297  //for (i = threshold.begin(); i != threshold.end(); ++i) {
298  // std::cout << '\t' << i->first
299  // << '\t' << i->second << std::endl;
300  //if (i->first == 3 ) fthres3 = i->second;
301  //if (i->first == 7 ) fthres7 = i->second;
302  //}
303 
304  // for (it = PEdist.begin(); it != PEdist.end(); ++it) {
305  // std::cout << '\t' << it->first
306  // << '\t' << it->second << std::endl;
307  //if (it->first == 3 ) fpe3 = it->second;
308  //if (it->first == 7 ) fpe7 = it->second;
309  //}
310 
311 
312 
313  fADCTree->Fill();
314  fadcval3.clear();
315  fadcval7.clear();
316  // std::cout << n << "\t" << three << "\t" << seven << "\t" <<"\t adcmax \t"<< adcmax << std::endl;
317 
318  /*
319  if (persistent_waveform_.find(channel) == persistent_waveform_.end())
320  {
321  TH2D* pwave = tfs->make<TH2D>(Form("persistent_waveform_%d",channel),Form("persistent_waveform_%d",channel), 500,0, 2000, 20000, 0, 20000);
322  pwave->SetTitle(Form("Persistent waveform - Channel %d",channel));
323  pwave->GetYaxis()->SetTitle("ADC value");
324  pwave->GetXaxis()->SetTitle("Time sample");
325  persistent_waveform_[channel] = pwave;
326  // std::cout << persistent_waveform_.find(channel)->second << std::endl;
327  }
328 
329  TH2D *pwavep = persistent_waveform_[channel];
330 
331  for (size_t iadc=0; iadc < waveformPtr->size(); ++iadc)
332  {
333 
334  auto adcval = waveformPtr->at(iadc);
335  //adc_values_->Fill(adcval);
336  // std::cout << iadc <<"\t" << adcval << "\t" << nADC << std::endl;
337  ///> Save the waveforms for all traces like an oscilloscope
338  pwavep->Fill(iadc,adcval,1); // (x,y,weight=1)
339  // hist->SetBinContent(iadc+1,adcval);
340  }
341 
342  }
343 */
344 
345 
346 }
Format
Definition: utils.h:7
std::map< int, int >::iterator i
uint8_t channel
Definition: CRTFragment.hh:201
std::map< int, int >::iterator adcit
std::map< int, int >::iterator itr
std::void_t< T > n
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
static int max(int a, int b)
art::ServiceHandle< art::TFileService > tfs
TCEvent evt
Definition: DataStructs.cxx:7
Definition: fwd.h:31
ICEBERGPDSSPMonitor& icebergpd::ICEBERGPDSSPMonitor::operator= ( ICEBERGPDSSPMonitor const &  )
delete
ICEBERGPDSSPMonitor& icebergpd::ICEBERGPDSSPMonitor::operator= ( ICEBERGPDSSPMonitor &&  )
delete

Member Data Documentation

std::map< int, int > icebergpd::ICEBERGPDSSPMonitor::ADC
private

Definition at line 85 of file ICEBERGPDSSPMonitor_module.cc.

std::map<int, int>::iterator icebergpd::ICEBERGPDSSPMonitor::adcit
private

Definition at line 89 of file ICEBERGPDSSPMonitor_module.cc.

std::map< int, TH1D* > icebergpd::ICEBERGPDSSPMonitor::avgWaveforms
private

Definition at line 78 of file ICEBERGPDSSPMonitor_module.cc.

std::map< int, int > icebergpd::ICEBERGPDSSPMonitor::countWaveform
private

Definition at line 79 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fadc3
private

Definition at line 111 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fadc7
private

Definition at line 112 of file ICEBERGPDSSPMonitor_module.cc.

TTree* icebergpd::ICEBERGPDSSPMonitor::fADCTree
private

Definition at line 101 of file ICEBERGPDSSPMonitor_module.cc.

std::vector< Int_t > icebergpd::ICEBERGPDSSPMonitor::fadcval3
private

Definition at line 118 of file ICEBERGPDSSPMonitor_module.cc.

std::vector< Int_t > icebergpd::ICEBERGPDSSPMonitor::fadcval7
private

Definition at line 117 of file ICEBERGPDSSPMonitor_module.cc.

float icebergpd::ICEBERGPDSSPMonitor::fbaseline3
private

Definition at line 114 of file ICEBERGPDSSPMonitor_module.cc.

float icebergpd::ICEBERGPDSSPMonitor::fbaseline7
private

Definition at line 115 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fdistpe
private

Definition at line 104 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fmaxadc3
private

Definition at line 102 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fmaxadc7
private

Definition at line 103 of file ICEBERGPDSSPMonitor_module.cc.

std::string icebergpd::ICEBERGPDSSPMonitor::fOpDetWaveformModuleLabel
private

Definition at line 72 of file ICEBERGPDSSPMonitor_module.cc.

std::string icebergpd::ICEBERGPDSSPMonitor::fOpHitModuleLabel
private

Definition at line 73 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fpe3
private

Definition at line 108 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fpe7
private

Definition at line 109 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fpedestal
private

Definition at line 105 of file ICEBERGPDSSPMonitor_module.cc.

double icebergpd::ICEBERGPDSSPMonitor::fSampleFreq
private

Definition at line 75 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fthres3
private

Definition at line 106 of file ICEBERGPDSSPMonitor_module.cc.

Float_t icebergpd::ICEBERGPDSSPMonitor::fthres7
private

Definition at line 107 of file ICEBERGPDSSPMonitor_module.cc.

std::map<int, int>::iterator icebergpd::ICEBERGPDSSPMonitor::i
private

Definition at line 91 of file ICEBERGPDSSPMonitor_module.cc.

std::map<int, int>::iterator icebergpd::ICEBERGPDSSPMonitor::itr
private

Definition at line 90 of file ICEBERGPDSSPMonitor_module.cc.

std::map< int, int > icebergpd::ICEBERGPDSSPMonitor::maxadc
private

Definition at line 86 of file ICEBERGPDSSPMonitor_module.cc.

std::map< int, TH1F* > icebergpd::ICEBERGPDSSPMonitor::maxadchist
private

Definition at line 84 of file ICEBERGPDSSPMonitor_module.cc.

std::map<size_t,TH2D*> icebergpd::ICEBERGPDSSPMonitor::persistent_waveform_
private

Definition at line 80 of file ICEBERGPDSSPMonitor_module.cc.

art::ServiceHandle< art::TFileService > icebergpd::ICEBERGPDSSPMonitor::tfs
private

Definition at line 95 of file ICEBERGPDSSPMonitor_module.cc.

std::map< int, int > icebergpd::ICEBERGPDSSPMonitor::threshold
private

Definition at line 87 of file ICEBERGPDSSPMonitor_module.cc.

std::map< size_t, TH2D* > icebergpd::ICEBERGPDSSPMonitor::Waveforms
private

Definition at line 82 of file ICEBERGPDSSPMonitor_module.cc.


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