Public Member Functions | Public Attributes | Private Attributes | List of all members
triggersim::TemplateTriggerProd Class Reference
Inheritance diagram for triggersim::TemplateTriggerProd:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 TemplateTriggerProd (fhicl::ParameterSet const &pset)
 
 TemplateTriggerProd (TemplateTriggerProd const &)=delete
 
 TemplateTriggerProd (TemplateTriggerProd &&)=delete
 
TemplateTriggerProdoperator= (TemplateTriggerProd const &)=delete
 
TemplateTriggerProdoperator= (TemplateTriggerProd &&)=delete
 
void produce (art::Event &event) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
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::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- 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)
 

Public Attributes

TemplateTrigger TempTrig
 

Private Attributes

art::ServiceHandle< cheat::ParticleInventoryServicepi_serv
 
std::string fAString
 
std::string fRawDigitLabel
 
std::string fOpDetWaveLabel
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- 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 47 of file TemplateTriggerProd_module.cc.

Constructor & Destructor Documentation

triggersim::TemplateTriggerProd::TemplateTriggerProd ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 83 of file TemplateTriggerProd_module.cc.

83  : EDProducer{pset},
84  TempTrig()
85  {
86  // --- Declare what this module is puttting in the art event.
87  produces< std::vector<triggersim::BasicTrigger> >();
88  // --- Configure my trigger module.
89  this->reconfigure(pset);
90  // --- Configure my trigger class.
91  TempTrig.Configure( pset );
92  }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
void reconfigure(fhicl::ParameterSet const &pset)
void Configure(fhicl::ParameterSet const &pset)
triggersim::TemplateTriggerProd::TemplateTriggerProd ( TemplateTriggerProd const &  )
delete
triggersim::TemplateTriggerProd::TemplateTriggerProd ( TemplateTriggerProd &&  )
delete

Member Function Documentation

TemplateTriggerProd& triggersim::TemplateTriggerProd::operator= ( TemplateTriggerProd const &  )
delete
TemplateTriggerProd& triggersim::TemplateTriggerProd::operator= ( TemplateTriggerProd &&  )
delete
void triggersim::TemplateTriggerProd::produce ( art::Event event)
overridevirtual

Implements art::EDProducer.

Definition at line 114 of file TemplateTriggerProd_module.cc.

115  {
116  // --- Make the vector of BasicTrigger objects:
117  std::unique_ptr< std::vector<triggersim::BasicTrigger> > triggers(new std::vector<triggersim::BasicTrigger>);
118 
119  // --- Lift out the TPC raw digits:
120  auto rawdigits = event.getValidHandle<std::vector<raw::RawDigit> >(fRawDigitLabel);
121  if ( rawdigits.failedToGet() )
122  mf::LogError("TemplateTrigger_Producer") << "The raw::RawDigit you gave me " << fRawDigitLabel << " is not in the event..." << std::endl;
123 
124  std::cout << "Let's get some rawdigit stuff...Size " << rawdigits->size() << " rawdigits[0]->samples() " << (*rawdigits)[0].Samples() << std::endl;
125 
126  // --- Lift out the Photon Detector OpDetWaveforms:
127  auto waveforms = event.getValidHandle<std::vector<raw::OpDetWaveform> >(fOpDetWaveLabel);
128  if ( rawdigits.failedToGet() )
129  mf::LogError("TemplateTrigger_Producer") << "The raw::OpDetWaveform you gave me " << fOpDetWaveLabel << " is not in the event..." << std::endl;
130 
131  // --- Lets get the MCTruth information out of the event using the backtracker we defined earlier...
132  const sim::ParticleList& plist = pi_serv->ParticleList();
133  // --- Now loop through the particle list.
134  for ( sim::ParticleList::const_iterator ipar = plist.begin(); ipar!=plist.end(); ++ipar) {
135  // --- Grab this particle.
136  simb::MCParticle *particle = ipar->second;
137  // Let's just write out what our primary particles are...
138  if (particle->Process() != "primary") continue; // Can also check that particle->Mother() != 0.
139  std::cout << "-- Particle with TrackID " << particle->TrackId() << ", which was a " << particle->PdgCode() << " was a primary and had initial energy " << particle->E()
140  << ", " << particle->NumberTrajectoryPoints() << " trajectory points, and " << particle->NumberDaughters() << " daughters. Process - " << particle->Process()
141  << std::endl;
142  }
143 
144  // **************************************************
145  // *********** Trigger on the whole event ***********
146  // **************************************************
147  std::cout << "\nLet's trigger on the whole event...." << std::endl;
148 
149  // --- Now call the class...
150  bool EvTrigDec = TempTrig.TriggerOnWholeEvent( event );
151 
152  // --- Make my basic trigger and push it back
154  triggers->push_back( my_ev_trig );
155 
156  std::cout << "I have now left my trigger, it's decision was " << EvTrigDec << ".\n" << std::endl;
157 
158  // **************************************************
159  // ************* Trigger on the TPC info ************
160  // **************************************************
161  std::cout << "\nLet's trigger on the TPC info...." << std::endl;
162 
163  // --- Now call the class...
164  bool TPCTrigDec = TempTrig.TriggerOnTPC( *rawdigits );
165 
166  // --- Make my basic trigger and push it back
168  triggers->push_back( my_tpc_trig );
169 
170  std::cout << "I have now left my trigger, it's decision was " << TPCTrigDec << ".\n" << std::endl;
171 
172  // **************************************************
173  // ******** Trigger on the OpDetWaveform info *******
174  // **************************************************
175  std::cout << "\nLet's trigger on the OpDetWaveform info...." << std::endl;
176 
177  // --- Now call the class...
178  bool PDTrigDec = TempTrig.TriggerOnPD( *waveforms );
179 
180  // --- Make my basic trigger and push it back
182  triggers->push_back( my_pd_trig );
183 
184  std::cout << "I have now left my trigger, it's decision was " << PDTrigDec << ".\n" << std::endl;
185 
186 
187  // **************************************************
188  // *** Trigger on the OpDetWaveform and TPC info ****
189  // **************************************************
190  std::cout << "\nLet's trigger on the TPC and OpDetWaveform info...." << std::endl;
191 
192  // --- Now call the class...
193  bool TPC_PD_TrigDec = TempTrig.TriggerOnTPC_PD( *rawdigits, *waveforms );
194 
195  // --- Make my basic trigger and push it back
196  triggersim::BasicTrigger my_tpc_pd_trig( TPC_PD_TrigDec , triggersim::kNu, triggersim::kNuBeam);
197  triggers->push_back( my_tpc_pd_trig );
198 
199  std::cout << "I have now left my trigger, it's decision was " << TPC_PD_TrigDec << ".\n" << std::endl;
200 
201 
202  // **************************************************
203  // **** Trigger some of the triggers we've made *****
204  // **************************************************
205  std::cout << "\nLet's trigger on the triggers I've just made...." << std::endl;
206 
207  // --- Now call the class...
208  bool Trig_TrigDec = TempTrig.TriggerOnTriggers( *triggers );
209 
210  // --- Make my basic trigger and push it back
211  triggersim::BasicTrigger my_trig_trig( Trig_TrigDec , triggersim::kNu, triggersim::kNuBeam);
212  triggers->push_back( my_trig_trig );
213 
214  std::cout << "I have now left my trigger, it's decision was " << Trig_TrigDec << ".\n" << std::endl;
215 
216  // **************************************************
217  // ******* Now put all of that into the event *******
218  // **************************************************
219  event.put(std::move(triggers));
220 
221  } // TemplateTriggerProd::produce()
double E(const int i=0) const
Definition: MCParticle.h:233
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:212
bool TriggerOnTPC(std::vector< raw::RawDigit > rawTPC)
art::ServiceHandle< cheat::ParticleInventoryService > pi_serv
bool TriggerOnTriggers(std::vector< triggersim::BasicTrigger > triggerVec)
intermediate_table::const_iterator const_iterator
const unsigned int kNu
Definition: TriggerTypes.h:17
std::string Process() const
Definition: MCParticle.h:215
int NumberDaughters() const
Definition: MCParticle.h:217
int TrackId() const
Definition: MCParticle.h:210
def move(depos, offset)
Definition: depos.py:107
const sim::ParticleList & ParticleList() const
bool TriggerOnTPC_PD(std::vector< raw::RawDigit > rawTPC, std::vector< raw::OpDetWaveform > rawPD)
bool TriggerOnPD(std::vector< raw::OpDetWaveform > rawPD)
QTextStream & endl(QTextStream &s)
const unsigned int kNuBeam
Definition: TriggerTypes.h:45
bool TriggerOnWholeEvent(art::Event &event)
void triggersim::TemplateTriggerProd::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 97 of file TemplateTriggerProd_module.cc.

98  {
99  // --- Pull the variables from the fcl file.
100  fAString = pset.get<std::string> ("AString");
101  fRawDigitLabel = pset.get<std::string> ("RawDigitLabel");
102  fOpDetWaveLabel = pset.get<std::string> ("OpDetWaveLabel");
103 
104  // To convince ourselves that they have been set, print them out...
105  std::cout << "\n------In my trigger module------\nThe fcl params have been set to :"
106  << "\n fAString: " << fAString
107  << "\n fRawDigitLabel: " << fRawDigitLabel
108  << "\n fOpDetWaveLabel: " << fOpDetWaveLabel
109  << "\n-------------------------------\n"
110  << std::endl;
111  }
std::string string
Definition: nybbler.cc:12
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string triggersim::TemplateTriggerProd::fAString
private

Definition at line 76 of file TemplateTriggerProd_module.cc.

std::string triggersim::TemplateTriggerProd::fOpDetWaveLabel
private

Definition at line 78 of file TemplateTriggerProd_module.cc.

std::string triggersim::TemplateTriggerProd::fRawDigitLabel
private

Definition at line 77 of file TemplateTriggerProd_module.cc.

art::ServiceHandle<cheat::ParticleInventoryService> triggersim::TemplateTriggerProd::pi_serv
private

Definition at line 73 of file TemplateTriggerProd_module.cc.

TemplateTrigger triggersim::TemplateTriggerProd::TempTrig

Definition at line 68 of file TemplateTriggerProd_module.cc.


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