Public Member Functions | Private Attributes | List of all members
triggersim::TemplateTrigger Class Reference

#include <TemplateTrigger.h>

Public Member Functions

 TemplateTrigger ()
 
 ~TemplateTrigger ()
 
void Configure (fhicl::ParameterSet const &pset)
 
bool TriggerOnWholeEvent (art::Event &event)
 
bool TriggerOnTPC (std::vector< raw::RawDigit > rawTPC)
 
bool TriggerOnPD (std::vector< raw::OpDetWaveform > rawPD)
 
bool TriggerOnTPC_PD (std::vector< raw::RawDigit > rawTPC, std::vector< raw::OpDetWaveform > rawPD)
 
bool TriggerOnTriggers (std::vector< triggersim::BasicTrigger > triggerVec)
 

Private Attributes

bool fMakeTrig
 Boolean which is passed as to whether to even attempt this trigger. More...
 
bool fTrigDecision
 did the trigger algorithm decide to keep this event? More...
 
unsigned int fNumber
 Some random number to change. More...
 
std::string fMyString
 
std::string fRawDigLabel
 
std::string fOpWaveLabel
 

Detailed Description

Definition at line 30 of file TemplateTrigger.h.

Constructor & Destructor Documentation

triggersim::TemplateTrigger::TemplateTrigger ( )

Definition at line 32 of file TemplateTrigger.cxx.

32 {}
triggersim::TemplateTrigger::~TemplateTrigger ( )
inline

Definition at line 37 of file TemplateTrigger.h.

37 {};

Member Function Documentation

void triggersim::TemplateTrigger::Configure ( fhicl::ParameterSet const &  pset)

Definition at line 37 of file TemplateTrigger.cxx.

37  {
38  fMakeTrig = true;
39  fMyString = pset.get<std::string> ("AString");
40  fRawDigLabel = pset.get<std::string> ("RawDigitLabel");
41  fOpWaveLabel = pset.get<std::string> ("OpDetWaveLabel");
42 
43  // --- We have got all of the fcl parameters here too, lets check that they are what we expect...
44  std::cout << "\n------In my trigger class------\nThe fcl params have been set to :"
45  << "\n fMyString: " << fMyString
46  << "\n fRawDigLabel: " << fRawDigLabel
47  << "\n fOpWaveLabel: " << fOpWaveLabel
48  << "\n-------------------------------\n"
49  << std::endl;
50 } // Configure
std::string string
Definition: nybbler.cc:12
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
QTextStream & endl(QTextStream &s)
bool triggersim::TemplateTrigger::TriggerOnPD ( std::vector< raw::OpDetWaveform rawPD)

Definition at line 140 of file TemplateTrigger.cxx.

140  {
141  // --- If for some reason you changed your mind about making this trigger...
142  if (!fMakeTrig) return false;
143 
144  // --- Now do stuff...
145  fNumber = rawPD.size();
146  for (unsigned int Wave=0; Wave < rawPD.size(); ++Wave) {
147  if (Wave < 5) {
148  raw::OpDetWaveform ThisWaveform = rawPD[Wave]; // Also, rawPD.at(Wave);
149  std::cout << " Looking at Wave " << Wave << " of " << rawPD.size() << ", it was on channel " << ThisWaveform.ChannelNumber() << ", at time " << ThisWaveform.TimeStamp()
150  << ", there are " << ThisWaveform.Waveform().size() << " ADCs in this waveform " << std::endl;
151  std::vector< short > WaveformVec = ThisWaveform.Waveform();
152  for (unsigned int WaveformLoop=0; WaveformLoop < WaveformVec.size(); ++WaveformLoop) {
153  if (WaveformLoop < 5) {
154  std::cout << " Element " << WaveformLoop << " of " << WaveformVec.size() << " has ADC value " << WaveformVec.at(WaveformLoop) << std::endl;
155  } // If WaveformLoop < 5
156  } // Loop over the Waveform() data member
157  } // If Wave < 5
158  } // Loop over rawPD
159 
160  // --- If there are any OpDetWaveforms return true.
161  if (fNumber) {
162  fTrigDecision = true;
163  } else {
164  fTrigDecision = false;
165  }
166 
167  // --- Return the result of the trigger.
168  return fTrigDecision;
169 } // TriggerOnPD
Channel_t ChannelNumber() const
Definition: OpDetWaveform.h:65
TimeStamp_t TimeStamp() const
Definition: OpDetWaveform.h:66
std::vector< ADC_Count_t > & Waveform()
Definition: OpDetWaveform.h:59
bool fTrigDecision
did the trigger algorithm decide to keep this event?
unsigned int fNumber
Some random number to change.
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
QTextStream & endl(QTextStream &s)
bool triggersim::TemplateTrigger::TriggerOnTPC ( std::vector< raw::RawDigit rawTPC)

Definition at line 90 of file TemplateTrigger.cxx.

90  {
91  // --- If for some reason you changed your mind about making this trigger...
92  if (!fMakeTrig) return false;
93 
94  // --- It is often helpful to make a geometry service handle.
96 
97  // --- Now do stuff...
98  fNumber = rawTPC.size();
99  for (unsigned int Dig=0; Dig < rawTPC.size(); ++Dig) {
100  raw::RawDigit ThisDig = rawTPC[Dig]; // Can also use rawTPC.at(Dig);
101  int Chan = rawTPC[Dig].Channel(); // Alternatively can access stuff by doing rawTPC[Dig]->Channel()
102  if (Dig < 5) {
103  std::cout << " Looking at Dig " << Dig << " of " << rawTPC.size() << ", it has " << ThisDig.Samples() << " samples on Channel " << ThisDig.Channel() << " ("<<Chan<<")"
104  << ", and " << ThisDig.NADC() << " ADCs with a pedestal of " << ThisDig.GetPedestal()
105  << std::endl;
106  for (unsigned int ADCLoop=0; ADCLoop < ThisDig.NADC(); ++ADCLoop) {
107  if (ADCLoop < 5) {
108  std::cout << " Looking at ADC " << ADCLoop << " of " << ThisDig.NADC() << ", it was " << ThisDig.ADC(ADCLoop) << std::endl;
109  } // If ADCLoop < 5
110  } // Loop over ADCs
111  } // If Dig < 5
112 
113  // --- It can be useful to select only specific types of channels, normally you just continue for one of them.
114  if (geom->SignalType(ThisDig.Channel()) == geo::kCollection) {
115  // --- Something for collection plane wires...
116  } else if (geom->SignalType(ThisDig.Channel()) == geo::kInduction) {
117  // --- Something for induction plane wires...
118  }
119 
120  } // Loop over rawPD
121 
122  std::cout << " I have just got into my template TPC trigger , fMakeTrig is " << fMakeTrig << ", and (size) fNumber is now " << fNumber << std::endl;
123 
124  // --- For now just trigger on how many raw::RawDigits there are in this event...
125  // --- This number for triggering in the trigger has ABSOLUTELY NO PHYSICS CONSIDERATIONS
126  // --- - Do not read even the slightest bit into this. This just ensures that not every event is triggered.
127  if (fNumber > 3700) {
128  fTrigDecision = true;
129  } else {
130  fTrigDecision = false;
131  }
132 
133  // --- Return the result of the trigger.
134  return fTrigDecision;
135 } // TriggerOnTPC
float GetPedestal() const
Definition: RawDigit.h:214
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:213
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
short ADC(int i) const
ADC vector element number i; no decompression is applied.
Definition: RawDigit.h:208
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
bool fTrigDecision
did the trigger algorithm decide to keep this event?
unsigned int fNumber
Some random number to change.
Signal from induction planes.
Definition: geo_types.h:145
size_t NADC() const
Number of elements in the compressed ADC sample vector.
Definition: RawDigit.h:207
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
QTextStream & endl(QTextStream &s)
Signal from collection planes.
Definition: geo_types.h:146
bool triggersim::TemplateTrigger::TriggerOnTPC_PD ( std::vector< raw::RawDigit rawTPC,
std::vector< raw::OpDetWaveform rawPD 
)

Definition at line 174 of file TemplateTrigger.cxx.

174  {
175  // --- If for some reason you changed your mind about making this trigger...
176  if (!fMakeTrig) return false;
177 
178  // --- Now do stuff...
179  std::cout << " The size of the RawDigits is " << rawTPC.size() << ", and the size of the OpDetWaveforms is " << rawPD.size() << std::endl;
180 
181  // --- Look at the above two function about how to access information out of either of these data products...
182 
183  // --- Just default the trigger to true.
184  fTrigDecision = true;
185 
186  // --- Return the result of the trigger.
187  return fTrigDecision;
188 } // TriggerOnTPC_PD
bool fTrigDecision
did the trigger algorithm decide to keep this event?
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
QTextStream & endl(QTextStream &s)
bool triggersim::TemplateTrigger::TriggerOnTriggers ( std::vector< triggersim::BasicTrigger triggerVec)

Definition at line 193 of file TemplateTrigger.cxx.

193  {
194 
195  std::cout << " Looking at TriggerOnTriggers...I currently have " << triggerVec.size() << " triggers." << std::endl;
196  for (unsigned int TrigVecLoop=0; TrigVecLoop < triggerVec.size(); ++TrigVecLoop) {
197  //triggersim::BasicTrigger ThisTrig = triggerVec.at(TrigVecLoop);
198  //std::cout << " Looking at Trigger " << TrigVecLoop << ", TrigDecision " << ThisTrig.TrigDecision() << ", TrigType " << ThisTrig.TrigType()
199  // << ", TrigSubtype " << ThisTrig.TrigSubType()
200  std::cout << " Looking at Trigger " << TrigVecLoop << ", TrigDecision " << triggerVec[TrigVecLoop].TrigDecision() << ", TrigType " << triggerVec[TrigVecLoop].TrigType()
201  << ", TrigSubtype " << triggerVec[TrigVecLoop].TrigSubType()
202 
203  << std::endl;
204  }
205 
206 
207  // --- Just default the trigger to true.
208  fTrigDecision = true;
209 
210  // --- Return the result of the trigger.
211  return fTrigDecision;
212 } // TriggerOnTriggers
bool fTrigDecision
did the trigger algorithm decide to keep this event?
QTextStream & endl(QTextStream &s)
bool triggersim::TemplateTrigger::TriggerOnWholeEvent ( art::Event event)

Definition at line 55 of file TemplateTrigger.cxx.

55  {
56  // --- If for some reason you changed your mind about making this trigger...
57  if (!fMakeTrig) return false;
58 
59  // --- Now do stuff...
60  fNumber = event.event();
61  std::cout << " I have just got into my template trigger for event " << event.event() << ", fMakeTrig is " << fMakeTrig << ", and fNumber is now " << fNumber << std::endl;
62 
63  // --- Lift out the TPC raw digits:
64  auto digits = event.getValidHandle<std::vector<raw::RawDigit> >(fRawDigLabel);
65  if ( digits.failedToGet() )
66  mf::LogError("TemplateTrigger_Algorithm") << "The raw::RawDigit you gave me " << fRawDigLabel << " is not in the event..." << std::endl;
67 
68  // --- Lift out the Photon Detector OpDetWaveforms:
69  auto waveforms = event.getValidHandle<std::vector<raw::OpDetWaveform> >(fOpWaveLabel);
70  if ( waveforms.failedToGet() )
71  mf::LogError("TemplateTrigger_Algorithm") << "The raw::OpDetWaveform you gave me " << fOpWaveLabel << " is not in the event..." << std::endl;
72 
73  // --- We have got the data products here too, look at the functions below to find out how to use them...
74  std::cout << " The size of digits is " << digits->size() << ", and the size of wave is " << waveforms->size() << std::endl;
75 
76  // --- Make a decision based on the event number...
77  if (event.event() < 3) {
78  fTrigDecision = true;
79  } else {
80  fTrigDecision = false;
81  }
82 
83  // --- Return the result of the trigger.
84  return fTrigDecision;
85 } // TriggerOnWholeEvent
EventNumber_t event() const
Definition: DataViewImpl.cc:85
bool fTrigDecision
did the trigger algorithm decide to keep this event?
unsigned int fNumber
Some random number to change.
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
QTextStream & endl(QTextStream &s)

Member Data Documentation

bool triggersim::TemplateTrigger::fMakeTrig
private

Boolean which is passed as to whether to even attempt this trigger.

Definition at line 73 of file TemplateTrigger.h.

std::string triggersim::TemplateTrigger::fMyString
private

Definition at line 77 of file TemplateTrigger.h.

unsigned int triggersim::TemplateTrigger::fNumber
private

Some random number to change.

Definition at line 75 of file TemplateTrigger.h.

std::string triggersim::TemplateTrigger::fOpWaveLabel
private

Definition at line 79 of file TemplateTrigger.h.

std::string triggersim::TemplateTrigger::fRawDigLabel
private

Definition at line 78 of file TemplateTrigger.h.

bool triggersim::TemplateTrigger::fTrigDecision
private

did the trigger algorithm decide to keep this event?

Definition at line 74 of file TemplateTrigger.h.


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