All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | Friends | List of all members
sbn::TriggerEmulationTree Class Reference

Fills a ROOT tree with trigger emulation results. More...

Inheritance diagram for sbn::TriggerEmulationTree:

Classes

struct  BeamInfo_t
 Data structure for the beam gate data in the tree. More...
 
struct  Config
 
struct  GlobalTriggerInfo_t
 Data structure for the global trigger data in the tree. More...
 

Public Types

using TriggerInfo_t = sbn::details::TriggerResponseManager::TriggerInfo_t
 Data record the trigger response branch is based on. More...
 
using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 TriggerEmulationTree (Parameters const &config)
 
void analyze (art::Event const &event) override
 
void endJob () override
 

Private Types

using TriggerInputSpec_t = sbn::details::TriggerResponseManager::TriggerInputSpec_t
 

Private Attributes

art::InputTag const fBeamGateProducer
 
art::InputTag const fTriggerProducer
 
std::string const fLogCategory
 
struct {
   unsigned int   run
 
   unsigned int   subRun
 
   unsigned int   event
 
fEventID
 
BeamInfo_t fBeamInfo
 
GlobalTriggerInfo_t fGlobalTriggerInfo
 Data for global trigger in tree. More...
 
TTree * fStoreTree = nullptr
 
unsigned int fTotalProcessed = 0U
 
sbn::details::TriggerResponseManager fTriggerResponses
 < Manages filling of trigger result branches. More...
 

Friends

TriggerInputSpec_t convert (Config::TriggerSpecConfig const &config)
 

Detailed Description

Fills a ROOT tree with trigger emulation results.

Trigger information

There are two distinct groups of information about triggers in the tree. The first one is the hardware trigger, that is the trigger that was actually used to decide to record the event. The other group of information is from trigger logic "emulation" on the collected data (optical detector waveforms): there may be multiple branches in this group, one for each emulated trigger logic, threshold and gate.

Simulated trigger information

A branch is added for each configured trigger logic. This module actually ignores the details of the logic yielding the results: a trigger result is a group of data products under the same tag. For example, a tag M1 (presumably, a very loose trigger logic requiring just one PMT pair above threshold anywhere in the detector, with no hint of which that threshold is) will produce a branch with name "M1" including information from the M1 data products (so far, only a collection of raw::Trigger is read). Note that a trigger object is expected to be present regardless whether the trigger fired or not. It is assumed that the trigger fired if at least one of the raw::Trigger::TriggerBits() is set, not fired otherwise.

Each branch mirrors a data record, TriggerInfo_t, reporting the response for one simulated trigger logic. The structure and interpretation of the trigger response branch is described in ROOT TTree code by the string in TriggerInfo_t::TriggerResponseBranchStructure, and its meaning is:

Definition at line 90 of file TriggerEmulationTree_module.cc.

Member Typedef Documentation

using sbn::TriggerEmulationTree::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 151 of file TriggerEmulationTree_module.cc.

Data record the trigger response branch is based on.

Definition at line 98 of file TriggerEmulationTree_module.cc.

Definition at line 93 of file TriggerEmulationTree_module.cc.

Constructor & Destructor Documentation

sbn::TriggerEmulationTree::TriggerEmulationTree ( Parameters const &  config)
explicit

Definition at line 243 of file TriggerEmulationTree_module.cc.

244  : art::EDAnalyzer{ config }
245  // configuration
246  , fBeamGateProducer { config().BeamGateProducer() }
247  , fTriggerProducer { config().TriggerProducer() }
248  , fLogCategory { config().LogCategory() }
249  // algorithms
250  , fStoreTree {
251  art::ServiceHandle<art::TFileService>()->make<TTree>
252  (config().TreeName().c_str(), "Trigger emulation results")
253  }
255  { config().EmulatedTriggers(), consumesCollector(), *fStoreTree }
256 {
257 
258  //
259  // declaration of input
260  //
261 
262  consumes<std::vector<sim::BeamGateInfo>>(fBeamGateProducer);
263 
264  //
265  // tree population
266  //
267  fStoreTree->Branch("run", &fEventID.run);
268  fStoreTree->Branch("subrun", &fEventID.subRun);
269  fStoreTree->Branch("event", &fEventID.event);
270  fStoreTree->Branch("beamInfo", &fBeamInfo, BeamInfo_t::branchDef);
271  fStoreTree->Branch
273 
274 } // sbn::TriggerEmulationTree::TriggerEmulationTree()
GlobalTriggerInfo_t fGlobalTriggerInfo
Data for global trigger in tree.
struct sbn::TriggerEmulationTree::@0 fEventID
sbn::details::TriggerResponseManager fTriggerResponses
&lt; Manages filling of trigger result branches.
fDetProps &fDetProps fDetProps &fDetProps consumesCollector())

Member Function Documentation

void sbn::TriggerEmulationTree::analyze ( art::Event const &  event)
override

Definition at line 277 of file TriggerEmulationTree_module.cc.

278 {
279  // Implementation of required member function here.
280  fEventID = { event.run(), event.subRun(), event.event() };
281 
282  //
283  // beam gate
284  //
285  fBeamInfo = {};
286 
287  auto const& beamgate
288  = event.getProduct<std::vector<sim::BeamGateInfo>>(fBeamGateProducer);
289  if(beamgate.empty())
290  mf::LogWarning(fLogCategory) << "No Beam Gate Information!";
291  if(beamgate.size() > 1U)
292  mf::LogWarning(fLogCategory) << "Event has multiple beam gate info labels! (maybe this changes later to be standard)";
293  fBeamInfo.beamGateSimStart = beamgate.front().Start();
294  fBeamInfo.beamGateDuration = beamgate.front().Width();
295  fBeamInfo.beamGateType = beamgate.front().BeamType();
296 
297  //
298  // hardware trigger
299  //
300  auto const& triggerinfo
301  = event.getProduct<sbn::ExtraTriggerInfo>(fTriggerProducer);
303  = static_cast<unsigned int>(triggerinfo.sourceType);
304  fGlobalTriggerInfo.triggerTime = triggerinfo.triggerTimestamp;
305  fGlobalTriggerInfo.beamGateTime = triggerinfo.beamGateTimestamp;
306  fGlobalTriggerInfo.triggerID = triggerinfo.triggerID;
307  fGlobalTriggerInfo.gateID = triggerinfo.gateID;
308 
309  // get an extractor bound to this event
310  sbn::details::TriggerResponseManager::Extractors triggerResponseExtractors
312 
313  triggerResponseExtractors.fetch(0); // only the first trigger in each list
314 
315  ++fTotalProcessed;
316  fStoreTree->Fill();
317 
318 } // sbn::TriggerEmulationTree::analyze()
GlobalTriggerInfo_t fGlobalTriggerInfo
Data for global trigger in tree.
struct sbn::TriggerEmulationTree::@0 fEventID
Additional information on trigger.
Extractors extractorsFor(art::Event const &event)
Returns an object to extract trigger information from event.
sbn::details::TriggerResponseManager fTriggerResponses
&lt; Manages filling of trigger result branches.
void sbn::TriggerEmulationTree::endJob ( )
override

Definition at line 322 of file TriggerEmulationTree_module.cc.

322  {
323 
324  mf::LogInfo(fLogCategory) << "Processed " << fTotalProcessed << " events.";
325 
326 } // sbn::TriggerEmulationTree::endJob()

Friends And Related Function Documentation

TriggerInputSpec_t convert ( Config::TriggerSpecConfig const &  config)
friend

Definition at line 231 of file TriggerEmulationTree_module.cc.

232  {
233  return {
234  config.Name() // name
235  , config.TriggerTag() // inputTag
236  };
237  } // convert(sbn::TriggerSpecConfig)

Member Data Documentation

unsigned int sbn::TriggerEmulationTree::event

Definition at line 200 of file TriggerEmulationTree_module.cc.

art::InputTag const sbn::TriggerEmulationTree::fBeamGateProducer
private

Definition at line 189 of file TriggerEmulationTree_module.cc.

BeamInfo_t sbn::TriggerEmulationTree::fBeamInfo
private

Definition at line 203 of file TriggerEmulationTree_module.cc.

struct { ... } sbn::TriggerEmulationTree::fEventID
GlobalTriggerInfo_t sbn::TriggerEmulationTree::fGlobalTriggerInfo
private

Data for global trigger in tree.

Definition at line 204 of file TriggerEmulationTree_module.cc.

std::string const sbn::TriggerEmulationTree::fLogCategory
private

Definition at line 191 of file TriggerEmulationTree_module.cc.

TTree* sbn::TriggerEmulationTree::fStoreTree = nullptr
private

Definition at line 208 of file TriggerEmulationTree_module.cc.

unsigned int sbn::TriggerEmulationTree::fTotalProcessed = 0U
private

Definition at line 210 of file TriggerEmulationTree_module.cc.

art::InputTag const sbn::TriggerEmulationTree::fTriggerProducer
private

Definition at line 190 of file TriggerEmulationTree_module.cc.

sbn::details::TriggerResponseManager sbn::TriggerEmulationTree::fTriggerResponses
private

< Manages filling of trigger result branches.

Definition at line 220 of file TriggerEmulationTree_module.cc.

unsigned int sbn::TriggerEmulationTree::run

Definition at line 198 of file TriggerEmulationTree_module.cc.

unsigned int sbn::TriggerEmulationTree::subRun

Definition at line 199 of file TriggerEmulationTree_module.cc.


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