Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
tbana::BeamlineTriggerAna Class Reference
Inheritance diagram for tbana::BeamlineTriggerAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 BeamlineTriggerAna (const fhicl::ParameterSet &pset)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void analyze (const art::Event &evt)
 
void beginJob ()
 
void beginRun (const art::Run &r)
 
void beginSubRun (const art::SubRun &sr)
 
void endJob ()
 
void endSubRun (const art::SubRun &sr)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

std::string fRawTriggerLabel
 
std::string fRawToFDigitLabel
 
std::string fRecoToFDigitLabel
 
std::string fRecoToFLabel
 
std::string fRawWCLabel
 
std::string fRawWCDigitLabel
 
std::string fRecoWCTrackLabel
 
std::string fRawPaddleDigitLabel
 
std::string fRecoPaddleDigitLabel
 
double fSpillLength
 
std::unique_ptr< BeamFolderfFolder
 
unsigned int fTriggersPerSpill
 
unsigned int fGoodTriggersPerSpill
 
uint64_t fLastTDUTime
 
unsigned int fLastSpill
 
unsigned int fTotSpills
 
unsigned int fTotTriggers
 
unsigned int fTotGoodTriggers
 
double fTotMC6IC
 
std::map< unsigned int, unsigned intfNumTriggers
 
std::map< unsigned int, unsigned intfNumGoodTriggers
 
std::map< unsigned int, unsigned intfNumPotentialTriggers
 
std::vector< unsigned intfNumAllPlanesHit
 
std::vector< unsigned intfNumAllPlanesExceptHit
 
std::vector< unsigned intfNumAllPaddlesHit
 
std::vector< unsigned intfNumAllPaddlesExceptHit
 
TFile * fOutFile
 
TH1I * hTriggersPerSpill
 
TH1F * hTriggersPerSpillNorm
 
TH1I * hGoodTriggersPerSpill
 
TH1F * hGoodTriggersPerSpillNorm
 
TProfile * hEventRecoInfo
 
TH1I * hTriggerBits
 
TProfile * hTriggerBitsFrac
 
TH1I * hPaddlesHit
 
TH1F * hWCPlaneEfficiency
 
TH1F * hPaddleEfficiency
 

Detailed Description

Definition at line 48 of file BeamlineTriggerAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

tbana::BeamlineTriggerAna::BeamlineTriggerAna ( const fhicl::ParameterSet pset)

Definition at line 116 of file BeamlineTriggerAna_module.cc.

References fFolder, fhicl::ParameterSet::get(), ifbeam_ns::IFBeam::getBeamFolder(), reconfigure(), and string.

116  : EDAnalyzer(pset) {
117  this->reconfigure(pset);
118 
120  fFolder = ifbeam->getBeamFolder(pset.get<std::string>("ifBundle"),
121  pset.get<std::string>("ifURL"),
122  pset.get<double>("ifDBTimeWindow"));
123 
124  // Look this far back in time for a spill, in seconds
125  fFolder->set_epsilon(pset.get<double>("ifEpsilon"));
126 }
void reconfigure(const fhicl::ParameterSet &pset)
T get(std::string const &key) const
Definition: ParameterSet.h:231
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
std::unique_ptr< BeamFolder > getBeamFolder(std::string bundle_name, std::string url="", double time_width=1200.0)
std::unique_ptr< BeamFolder > fFolder
enum BeamMode string

Member Function Documentation

void tbana::BeamlineTriggerAna::analyze ( const art::Event evt)

Definition at line 312 of file BeamlineTriggerAna_module.cc.

References DEFINE_ART_MODULE(), fGoodTriggersPerSpill, art::fill_ptr_vector(), fLastTDUTime, fNumAllPaddlesExceptHit, fNumAllPaddlesHit, fNumAllPlanesExceptHit, fNumAllPlanesHit, fRawPaddleDigitLabel, fRawTriggerLabel, fRawWCLabel, fRecoPaddleDigitLabel, fRecoToFDigitLabel, fRecoToFLabel, fRecoWCTrackLabel, fTotGoodTriggers, fTotTriggers, fTriggersPerSpill, art::DataViewImpl::getByLabel(), hEventRecoInfo, hPaddlesHit, hTriggerBits, hTriggerBitsFrac, and NDAPDHVSetting::plane.

312  {
313 
314  // Get data from art::Event
315 
316  // Raw trigger objects
318  std::vector<art::Ptr<rawdata::RawBeamlineTrigger> > triggers;
319  if (evt.getByLabel(fRawTriggerLabel, triggerHandle))
320  art::fill_ptr_vector(triggers, triggerHandle);
321 
322  // Reco ToF digits
324  std::vector<art::Ptr<brb::BeamlineDigit> > tofDigits;
325  if (evt.getByLabel(fRecoToFDigitLabel, tofDigitHandle))
326  art::fill_ptr_vector(tofDigits, tofDigitHandle);
327 
328  // Reco ToF
330  std::vector<art::Ptr<brb::ToF> > tofs;
331  if (evt.getByLabel(fRecoToFLabel, tofHandle))
332  art::fill_ptr_vector(tofs, tofHandle);
333 
334  // Raw paddle digits
336  std::vector<art::Ptr<rawdata::RawBeamlineDigit> > rawPaddleDigits;
337  if (evt.getByLabel(fRawPaddleDigitLabel, rawPaddleDigitHandle))
338  art::fill_ptr_vector(rawPaddleDigits, rawPaddleDigitHandle);
339 
340  // Reco paddle digits
341  art::Handle<std::vector<brb::BeamlineDigit> > recoPaddleDigitHandle;
342  std::vector<art::Ptr<brb::BeamlineDigit> > recoPaddleDigits;
343  if (evt.getByLabel(fRecoPaddleDigitLabel, recoPaddleDigitHandle))
344  art::fill_ptr_vector(recoPaddleDigits, recoPaddleDigitHandle);
345 
346  // Raw wire chambers
348  std::vector<art::Ptr<rawdata::RawBeamlineWC> > wcs;
349  if (evt.getByLabel(fRawWCLabel, wcHandle))
350  art::fill_ptr_vector(wcs, wcHandle);
351 
352  // Reco WC tracks
354  std::vector<art::Ptr<brb::WCTrack> > wcTracks;
355  if (evt.getByLabel(fRecoWCTrackLabel, wcTrackHandle))
356  art::fill_ptr_vector(wcTracks, wcTrackHandle);
357 
358  // Trigger bits
359  fLastTDUTime = triggers[0]->TDUTime();
360  uint32_t triggerPattern = triggers[0]->Pattern();
361  for (unsigned int bit = 0; bit < 16; ++bit) {
362  hTriggerBits->Fill(bit, std::bitset<16>(triggerPattern)[bit]);
363  hTriggerBitsFrac->Fill(bit, std::bitset<16>(triggerPattern)[bit]);
364  }
365 
366  // Get paddle digits
367  std::vector<art::Ptr<brb::BeamlineDigit> > tcDigits, paddleDigits;
368  for (std::vector<art::Ptr<brb::BeamlineDigit> >::const_iterator digitIt = recoPaddleDigits.begin();
369  digitIt != recoPaddleDigits.end(); ++digitIt) {
370  if ((*digitIt)->ChannelID().Channel == 0)
371  tcDigits.push_back(*digitIt);
372  else
373  paddleDigits.push_back(*digitIt);
374  }
375 
376  // Get TC hit
377  bool particleOnTarget = tcDigits.size() == 1;
378  if (!particleOnTarget)
379  return;
380 
381  // ------------- Begin counting -------------
382 
383  ++fTotTriggers;
385 
386  // Event reco information
387  bool tofReco = tofs.size(), wcTrackReco = wcTracks.size();
388  hEventRecoInfo->Fill("ToF Reco", tofReco);
389  hEventRecoInfo->Fill("WCTrack Reco", wcTrackReco);
390  hEventRecoInfo->Fill("Both", tofReco and wcTrackReco);
391  if (tofReco and wcTrackReco) {
394  }
395 
396  // Paddles hit
397  std::vector<bool> paddleHit(4, false);
398  for (std::vector<art::Ptr<brb::BeamlineDigit> >::const_iterator paddleDigitIt = paddleDigits.begin();
399  paddleDigitIt != paddleDigits.end(); ++paddleDigitIt)
400  paddleHit[(*paddleDigitIt)->ChannelID().Channel-1] = true;
401 
402  for (unsigned int paddle = 0; paddle < 4; ++paddle)
403  if (paddleHit[paddle])
404  hPaddlesHit->Fill(paddle);
405 
406  std::vector<bool> wcHit(4, false);
407  std::vector<bool> wcPlaneHit(8, false);
408  for (unsigned int wcIt = 0; wcIt < wcs.size(); ++wcIt) {
409  std::vector<rawdata::RawBeamlineWC::WCPulse> x_pulses = wcs[wcIt]->XPulses();
410  std::vector<rawdata::RawBeamlineWC::WCPulse> y_pulses = wcs[wcIt]->YPulses();
411  if (x_pulses.size())
412  wcPlaneHit[2*wcIt] = true;
413  if (y_pulses.size())
414  wcPlaneHit[(2*wcIt)+1] = true;
415  if (x_pulses.size() and y_pulses.size())
416  wcHit[wcIt] = true;
417  }
418 
419  // Wire chamber plane efficiency
420  for (unsigned int plane = 0; plane < 8; ++plane) {
421  int allOtherPlanesHit = true;
422  for (unsigned int otherPlane = 0; otherPlane < 8; ++otherPlane)
423  if ((otherPlane != plane) and !wcPlaneHit[otherPlane])
424  allOtherPlanesHit = false;
425  if (!allOtherPlanesHit)
426  continue;
427  if (wcPlaneHit[plane])
429  else
431  }
432 
433  // Paddle efficiency
434  for (unsigned int paddle = 0; paddle < 4; ++paddle) {
435  int allOtherPaddlesHits = true;
436  for (unsigned int otherPaddle = 0; otherPaddle < 4; ++otherPaddle)
437  if ((otherPaddle != paddle) and !paddleHit[otherPaddle])
438  allOtherPaddlesHits = false;
439  if (!allOtherPaddlesHits)
440  continue;
441  if (paddleHit[paddle])
442  ++fNumAllPaddlesHit[paddle];
443  else
444  ++fNumAllPaddlesExceptHit[paddle];
445  }
446 
447  return;
448 
449 }
std::vector< unsigned int > fNumAllPlanesHit
std::vector< unsigned int > fNumAllPaddlesExceptHit
std::vector< unsigned int > fNumAllPaddlesHit
std::vector< unsigned int > fNumAllPlanesExceptHit
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Definition: fwd.h:28
void tbana::BeamlineTriggerAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 143 of file BeamlineTriggerAna_module.cc.

References fNumAllPaddlesExceptHit, fNumAllPaddlesHit, fNumAllPlanesExceptHit, fNumAllPlanesHit, fOutFile, fTotGoodTriggers, fTotMC6IC, fTotSpills, fTotTriggers, hEventRecoInfo, hGoodTriggersPerSpill, hGoodTriggersPerSpillNorm, hPaddleEfficiency, hPaddlesHit, hTriggerBits, hTriggerBitsFrac, hTriggersPerSpill, hTriggersPerSpillNorm, hWCPlaneEfficiency, and NDAPDHVSetting::plane.

143  {
144  gStyle->SetOptStat(0);
145  fOutFile = new TFile("BeamlineTriggerAna.root", "RECREATE");
146  fTotSpills = 0;
147  fTotTriggers = 0;
148  fTotGoodTriggers = 0;
149  fTotMC6IC = 0.;
150  fNumAllPlanesHit.reserve(8);
151  fNumAllPlanesExceptHit.reserve(8);
152  for (unsigned int plane = 0; plane < 8; ++plane) {
153  fNumAllPlanesHit[plane] = 0;
155  }
156  fNumAllPaddlesHit.reserve(4);
157  fNumAllPaddlesExceptHit.reserve(4);
158  for (unsigned int paddle = 0; paddle < 4; ++paddle) {
159  fNumAllPaddlesHit[paddle] = 0;
160  fNumAllPaddlesExceptHit[paddle] = 0;
161  }
162  hTriggersPerSpill = new TH1I("TriggersPerSpill", ";Number of Triggers / Spill;", 60, 0, 60);
163  hTriggersPerSpillNorm = new TH1F("TriggersPerSpillNorm", ";Number of Triggers / Spill / 1e9ppp;", 100, 0, 10);
164  hGoodTriggersPerSpill = new TH1I("GoodTriggersPerSpill", ";Number of Good Triggers / Spill", 60, 0, 60);
165  hGoodTriggersPerSpillNorm = new TH1F("GoodTriggersPerSpillNorm", ";Number of Good Triggers / Spill / 1e9ppp;", 100, 0, 10);
166  hEventRecoInfo = new TProfile("EventRecoInfo", ";;Fraction of Events;", 3, 0, 3);
167  hEventRecoInfo->GetXaxis()->SetBinLabel(1, "ToF Reco");
168  hEventRecoInfo->GetXaxis()->SetBinLabel(2, "WCTrack Reco");
169  hEventRecoInfo->GetXaxis()->SetBinLabel(3, "Both");
170  hEventRecoInfo->GetYaxis()->SetRangeUser(0, 1);
171  hTriggerBits = new TH1I("TriggerBits", ";Trigger Bit;", 16, 0, 16);
172  hTriggerBits->GetXaxis()->SetNdivisions(16);
173  hTriggerBits->GetXaxis()->CenterLabels();
174  hTriggerBits->SetMinimum(0);
175  hTriggerBitsFrac = new TProfile("TriggerBitsFrac", ";Trigger Bit;", 16, 0, 16);
176  hTriggerBitsFrac->GetXaxis()->SetNdivisions(16);
177  hTriggerBitsFrac->GetXaxis()->CenterLabels();
178  hTriggerBitsFrac->GetYaxis()->SetRangeUser(0, 1);
179  hPaddlesHit = new TH1I("PaddlesHit", ";Paddle;", 4, 0, 4);
180  hPaddlesHit->GetXaxis()->SetNdivisions(4);
181  hPaddlesHit->GetXaxis()->CenterLabels();
182  hPaddlesHit->SetMinimum(0);
183  hWCPlaneEfficiency = new TH1F("WCPlaneEfficiency", ";Plane;", 8, 0, 8);
184  hWCPlaneEfficiency->GetXaxis()->SetNdivisions(8);
185  hWCPlaneEfficiency->GetXaxis()->CenterLabels();
186  hWCPlaneEfficiency->GetYaxis()->SetRangeUser(0, 1);
187  hPaddleEfficiency = new TH1F("PaddleEfficiency", ";Paddle;", 4, 0, 4);
188  hPaddleEfficiency->GetXaxis()->SetNdivisions(4);
189  hPaddleEfficiency->GetXaxis()->CenterLabels();
190  hPaddleEfficiency->GetYaxis()->SetRangeUser(0, 1);
191 }
std::vector< unsigned int > fNumAllPlanesHit
std::vector< unsigned int > fNumAllPaddlesExceptHit
std::vector< unsigned int > fNumAllPaddlesHit
std::vector< unsigned int > fNumAllPlanesExceptHit
void tbana::BeamlineTriggerAna::beginRun ( const art::Run r)

Definition at line 194 of file BeamlineTriggerAna_module.cc.

References fLastSpill.

194  {
195  fLastSpill = 0;
196 }
void tbana::BeamlineTriggerAna::beginSubRun ( const art::SubRun sr)

Definition at line 199 of file BeamlineTriggerAna_module.cc.

References fGoodTriggersPerSpill, fLastSpill, fNumGoodTriggers, fNumTriggers, fTotSpills, fTriggersPerSpill, and art::SubRun::subRun().

199  {
200 
201  ++fTotSpills;
202 
203  // Take into account spills with no triggers
204  unsigned int spillsWithoutTriggers = sr.subRun()-fLastSpill-1;
205  fNumTriggers[0] += spillsWithoutTriggers;
206  fNumGoodTriggers[0] += spillsWithoutTriggers;
207  fTotSpills += spillsWithoutTriggers;
208 
209  fTriggersPerSpill = 0;
211 
212 }
SubRunNumber_t subRun() const
Definition: SubRun.h:44
std::map< unsigned int, unsigned int > fNumGoodTriggers
std::map< unsigned int, unsigned int > fNumTriggers
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
void tbana::BeamlineTriggerAna::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 215 of file BeamlineTriggerAna_module.cc.

References om::cout, allTimeWatchdog::endl, fNumAllPaddlesExceptHit, fNumAllPaddlesHit, fNumAllPlanesExceptHit, fNumAllPlanesHit, fNumGoodTriggers, fNumTriggers, fOutFile, fTotGoodTriggers, fTotMC6IC, fTotSpills, fTotTriggers, hEventRecoInfo, hGoodTriggersPerSpill, hGoodTriggersPerSpillNorm, hPaddleEfficiency, hPaddlesHit, hTriggerBits, hTriggerBitsFrac, hTriggersPerSpill, hTriggersPerSpillNorm, hWCPlaneEfficiency, and NDAPDHVSetting::plane.

215  {
216 
217  fOutFile->cd();
218  for (unsigned int plane = 0; plane < 8; ++plane)
221  for (unsigned int paddle = 0; paddle < 4; ++paddle)
222  hPaddleEfficiency->Fill(paddle,
223  (double)fNumAllPaddlesHit[paddle]/((double)fNumAllPaddlesHit[paddle]+fNumAllPaddlesExceptHit[paddle]));
224  hTriggersPerSpill->Write();
225  hTriggersPerSpillNorm->Write();
226  hGoodTriggersPerSpill->Write();
227  hGoodTriggersPerSpillNorm->Write();
228  hEventRecoInfo->Write();
229  hTriggerBits->Write();
230  hTriggerBitsFrac->Write();
231  hPaddlesHit->Write();
232  hWCPlaneEfficiency->Write();
233  hPaddleEfficiency->Write();
234  fOutFile->Close();
235  delete fOutFile;
236 
237  // Trigger information
238  std::cout << "Total spills: " << fTotSpills << std::endl;
239  std::cout << "Total triggers: " << fTotTriggers << std::endl;
240  std::cout << "Triggers/1e9ppp: " << (double)fTotTriggers/(double)(fTotMC6IC/1e9) << std::endl;
241  for (std::map<unsigned int, unsigned int>::const_iterator numTrigIt = fNumTriggers.begin();
242  numTrigIt != fNumTriggers.end(); ++numTrigIt)
243  std::cout << " Spill(s) with " << numTrigIt->first << " triggers: " << numTrigIt->second
244  << " (" << (double)numTrigIt->second*100/(double)fTotSpills << "%)" << std::endl;
245  std::cout << "Total good triggers: " << fTotGoodTriggers
246  << " (" << (double)fTotGoodTriggers*100/(double)fTotTriggers << "%)" << std::endl;
247  std::cout << "Good Triggers/1e9ppp: " << (double)fTotGoodTriggers/(double)(fTotMC6IC/1e9) << std::endl;
248  for (std::map<unsigned int, unsigned int>::const_iterator numTrigIt = fNumGoodTriggers.begin();
249  numTrigIt != fNumGoodTriggers.end(); ++numTrigIt)
250  std::cout << " Spill(s) with " << numTrigIt->first << " good triggers: " << numTrigIt->second
251  << " (" << (double)numTrigIt->second*100/(double)fTotSpills << "%)" << std::endl;
252 
253 }
std::vector< unsigned int > fNumAllPlanesHit
const XML_Char * s
Definition: expat.h:262
std::vector< unsigned int > fNumAllPaddlesExceptHit
std::vector< unsigned int > fNumAllPaddlesHit
std::map< unsigned int, unsigned int > fNumGoodTriggers
std::vector< unsigned int > fNumAllPlanesExceptHit
OStream cout
Definition: OStream.cxx:6
std::map< unsigned int, unsigned int > fNumTriggers
#define for
Definition: msvc_pragmas.h:3
void tbana::BeamlineTriggerAna::endSubRun ( const art::SubRun sr)

Definition at line 256 of file BeamlineTriggerAna_module.cc.

References novadaq::timeutils::convertNovaTimeToUnixTime(), om::cout, e, allTimeWatchdog::endl, fFolder, fGoodTriggersPerSpill, fLastSpill, fLastTDUTime, check_time_usage::float, fNumGoodTriggers, fNumTriggers, fSpillLength, fTotMC6IC, fTriggersPerSpill, hGoodTriggersPerSpill, hGoodTriggersPerSpillNorm, hTriggersPerSpill, hTriggersPerSpillNorm, string, art::SubRun::subRun(), and msf_helper::timespec.

256  {
257 
260 
261  // Get data from database
262 
263  // Intensity of spill
264  // Get trigger time in unix time
265  struct timespec unixTime;
267  const double eventTime = unixTime.tv_sec + 1e-9*unixTime.tv_nsec;
268 
269  // Query the database to get MC6IC end spill time.
270  // Since we are querying $36, have to add an offset to get the end spill time,
271  // rather than when the spill actually starts. The epsilon on the beam folder should be
272  // large enough to encapsulate the entire spill, plus any offset.
273  // Test Beam spills are ~4.2s long.
274 
275  double mc6ic = -999.;
276  double mc7sc1 = -999.;
277  double novtsc01 = -999.;
278  double time = -999.;
279  try{
280  fFolder->GetNamedData(eventTime+fSpillLength, "F:MC6IC@", &mc6ic, &time);
281  fFolder->GetNamedData(eventTime+fSpillLength, "F:MC7SC1@", &mc7sc1, &time);
282  //fFolder->GetNamedData(eventTime+fSpillLength, "Z:NOVTSC01@", &novtsc01, &time);
283  }
284  catch(std::exception& e) {
285  std::string err(e.what());
286  // If the variable can't be found, it means there was no spill within Epsilon of eventTime+fSpillLength
287  if (!err.find("variable not found")) {
288  mf::LogError("BeamlineTriggerAna") << "Exception encountered: " << e.what();
289  abort();
290  }
291  }
292 
293  std::cout << "End of spill, MC6IC " << mc6ic << ", MC7SC1 " << mc7sc1 << ", NOVTSC01 " << novtsc01 << std::endl;
294 
295  fTotMC6IC += mc6ic;
296 
297  float triggersPerSpillNorm = ((float)fTriggersPerSpill)/(mc6ic/1.e9);
298  float goodTriggersPerSpillNorm = ((float)fGoodTriggersPerSpill)/(mc6ic/1.e9);
299 
300  // std::cout << "Number of triggers " << fTriggersPerSubrun << ", and good " << fGoodTriggersPerSubrun << "; intensity " << mc6ic << std::endl;
301  // std::cout << "Normalized triggers per spill " << triggersPerSubrunNorm << ", and good " << goodTriggersPerSubrunNorm << std::endl;
302 
305  hTriggersPerSpillNorm->Fill(triggersPerSpillNorm);
306  hGoodTriggersPerSpillNorm->Fill(goodTriggersPerSpillNorm);
307 
308  fLastSpill = sr.subRun();
309 }
SubRunNumber_t subRun() const
Definition: SubRun.h:44
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
std::map< unsigned int, unsigned int > fNumGoodTriggers
OStream cout
Definition: OStream.cxx:6
std::map< unsigned int, unsigned int > fNumTriggers
std::unique_ptr< BeamFolder > fFolder
Float_t e
Definition: plot.C:35
enum BeamMode string
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void tbana::BeamlineTriggerAna::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 129 of file BeamlineTriggerAna_module.cc.

References fRawPaddleDigitLabel, fRawToFDigitLabel, fRawTriggerLabel, fRawWCDigitLabel, fRawWCLabel, fRecoPaddleDigitLabel, fRecoToFDigitLabel, fRecoToFLabel, fRecoWCTrackLabel, fSpillLength, fhicl::ParameterSet::get(), and string.

Referenced by BeamlineTriggerAna().

129  {
130  fRawTriggerLabel = pset.get<std::string>("RawTriggerLabel");
131  fRawToFDigitLabel = pset.get<std::string>("RawToFDigitLabel");
132  fRecoToFDigitLabel = pset.get<std::string>("RecoToFDigitLabel");
133  fRecoToFLabel = pset.get<std::string>("RecoToFLabel");
134  fRawWCLabel = pset.get<std::string>("RawWCLabel");
135  fRawWCDigitLabel = pset.get<std::string>("RawWCDigitLabel");
136  fRecoWCTrackLabel = pset.get<std::string>("RecoWCTrackLabel");
137  fRawPaddleDigitLabel = pset.get<std::string>("RawPaddleDigitLabel");
138  fRecoPaddleDigitLabel = pset.get<std::string>("RecoPaddleDigitLabel");
139  fSpillLength = pset.get<double> ("SpillLength");
140 }
T get(std::string const &key) const
Definition: ParameterSet.h:231
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

std::unique_ptr<BeamFolder> tbana::BeamlineTriggerAna::fFolder
private

Definition at line 77 of file BeamlineTriggerAna_module.cc.

Referenced by BeamlineTriggerAna(), and endSubRun().

unsigned int tbana::BeamlineTriggerAna::fGoodTriggersPerSpill
private

Definition at line 81 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginSubRun(), and endSubRun().

unsigned int tbana::BeamlineTriggerAna::fLastSpill
private

Definition at line 83 of file BeamlineTriggerAna_module.cc.

Referenced by beginRun(), beginSubRun(), and endSubRun().

uint64_t tbana::BeamlineTriggerAna::fLastTDUTime
private

Definition at line 82 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and endSubRun().

std::vector<unsigned int> tbana::BeamlineTriggerAna::fNumAllPaddlesExceptHit
private

Definition at line 94 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

std::vector<unsigned int> tbana::BeamlineTriggerAna::fNumAllPaddlesHit
private

Definition at line 93 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

std::vector<unsigned int> tbana::BeamlineTriggerAna::fNumAllPlanesExceptHit
private

Definition at line 92 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

std::vector<unsigned int> tbana::BeamlineTriggerAna::fNumAllPlanesHit
private

Definition at line 91 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

std::map<unsigned int, unsigned int> tbana::BeamlineTriggerAna::fNumGoodTriggers
private

Definition at line 89 of file BeamlineTriggerAna_module.cc.

Referenced by beginSubRun(), endJob(), and endSubRun().

std::map<unsigned int, unsigned int> tbana::BeamlineTriggerAna::fNumPotentialTriggers
private

Definition at line 90 of file BeamlineTriggerAna_module.cc.

std::map<unsigned int, unsigned int> tbana::BeamlineTriggerAna::fNumTriggers
private

Definition at line 88 of file BeamlineTriggerAna_module.cc.

Referenced by beginSubRun(), endJob(), and endSubRun().

TFile* tbana::BeamlineTriggerAna::fOutFile
private

Definition at line 97 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), and endJob().

std::string tbana::BeamlineTriggerAna::fRawPaddleDigitLabel
private

Definition at line 72 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRawToFDigitLabel
private

Definition at line 66 of file BeamlineTriggerAna_module.cc.

Referenced by reconfigure().

std::string tbana::BeamlineTriggerAna::fRawTriggerLabel
private

Definition at line 65 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRawWCDigitLabel
private

Definition at line 70 of file BeamlineTriggerAna_module.cc.

Referenced by reconfigure().

std::string tbana::BeamlineTriggerAna::fRawWCLabel
private

Definition at line 69 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRecoPaddleDigitLabel
private

Definition at line 73 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRecoToFDigitLabel
private

Definition at line 67 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRecoToFLabel
private

Definition at line 68 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

std::string tbana::BeamlineTriggerAna::fRecoWCTrackLabel
private

Definition at line 71 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), and reconfigure().

double tbana::BeamlineTriggerAna::fSpillLength
private

Definition at line 74 of file BeamlineTriggerAna_module.cc.

Referenced by endSubRun(), and reconfigure().

unsigned int tbana::BeamlineTriggerAna::fTotGoodTriggers
private

Definition at line 86 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

double tbana::BeamlineTriggerAna::fTotMC6IC
private

Definition at line 87 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

unsigned int tbana::BeamlineTriggerAna::fTotSpills
private

Definition at line 84 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), beginSubRun(), and endJob().

unsigned int tbana::BeamlineTriggerAna::fTotTriggers
private

Definition at line 85 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

unsigned int tbana::BeamlineTriggerAna::fTriggersPerSpill
private

Definition at line 80 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginSubRun(), and endSubRun().

TProfile* tbana::BeamlineTriggerAna::hEventRecoInfo
private

Definition at line 104 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TH1I* tbana::BeamlineTriggerAna::hGoodTriggersPerSpill
private

Definition at line 102 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

TH1F* tbana::BeamlineTriggerAna::hGoodTriggersPerSpillNorm
private

Definition at line 103 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

TH1F* tbana::BeamlineTriggerAna::hPaddleEfficiency
private

Definition at line 109 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), and endJob().

TH1I* tbana::BeamlineTriggerAna::hPaddlesHit
private

Definition at line 107 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TH1I* tbana::BeamlineTriggerAna::hTriggerBits
private

Definition at line 105 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TProfile* tbana::BeamlineTriggerAna::hTriggerBitsFrac
private

Definition at line 106 of file BeamlineTriggerAna_module.cc.

Referenced by analyze(), beginJob(), and endJob().

TH1I* tbana::BeamlineTriggerAna::hTriggersPerSpill
private

Definition at line 100 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

TH1F* tbana::BeamlineTriggerAna::hTriggersPerSpillNorm
private

Definition at line 101 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

TH1F* tbana::BeamlineTriggerAna::hWCPlaneEfficiency
private

Definition at line 108 of file BeamlineTriggerAna_module.cc.

Referenced by beginJob(), and endJob().


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