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

#include <ActivityTrigger.h>

Public Member Functions

 ActivityTrigger ()
 
 ~ActivityTrigger ()
 
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 ActivityTrigger.h.

Constructor & Destructor Documentation

triggersim::ActivityTrigger::ActivityTrigger ( )

Definition at line 32 of file ActivityTrigger.cxx.

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

Definition at line 37 of file ActivityTrigger.h.

37 {};

Member Function Documentation

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

Definition at line 37 of file ActivityTrigger.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::ActivityTrigger::TriggerOnPD ( std::vector< raw::OpDetWaveform rawPD)

Definition at line 138 of file ActivityTrigger.cxx.

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

Definition at line 90 of file ActivityTrigger.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 activity TPC trigger , fMakeTrig is " << fMakeTrig << ", and (size) fNumber is now " << fNumber << std::endl;
123 
124  // --- For now just trigger on how raw::RawDigits there are in this event...
125  if (fNumber > 3700) {
126  fTrigDecision = true;
127  } else {
128  fTrigDecision = false;
129  }
130 
131  // --- Return the result of the trigger.
132  return fTrigDecision;
133 } // 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.
Signal from induction planes.
Definition: geo_types.h:145
unsigned int fNumber
Some random number to change.
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.
bool fTrigDecision
did the trigger algorithm decide to keep this event?
QTextStream & endl(QTextStream &s)
Signal from collection planes.
Definition: geo_types.h:146
bool triggersim::ActivityTrigger::TriggerOnTPC_PD ( std::vector< raw::RawDigit rawTPC,
std::vector< raw::OpDetWaveform rawPD 
)

Definition at line 172 of file ActivityTrigger.cxx.

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

Definition at line 191 of file ActivityTrigger.cxx.

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

Definition at line 55 of file ActivityTrigger.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 activity 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("ActivityTrigger_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("ActivityTrigger_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
unsigned int fNumber
Some random number to change.
bool fMakeTrig
Boolean which is passed as to whether to even attempt this trigger.
bool fTrigDecision
did the trigger algorithm decide to keep this event?
QTextStream & endl(QTextStream &s)

Member Data Documentation

bool triggersim::ActivityTrigger::fMakeTrig
private

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

Definition at line 73 of file ActivityTrigger.h.

std::string triggersim::ActivityTrigger::fMyString
private

Definition at line 77 of file ActivityTrigger.h.

unsigned int triggersim::ActivityTrigger::fNumber
private

Some random number to change.

Definition at line 75 of file ActivityTrigger.h.

std::string triggersim::ActivityTrigger::fOpWaveLabel
private

Definition at line 79 of file ActivityTrigger.h.

std::string triggersim::ActivityTrigger::fRawDigLabel
private

Definition at line 78 of file ActivityTrigger.h.

bool triggersim::ActivityTrigger::fTrigDecision
private

did the trigger algorithm decide to keep this event?

Definition at line 74 of file ActivityTrigger.h.


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