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

#include <CRTDetSim.h>

Inheritance diagram for sbnd::crt::CRTDetSim:

Public Member Functions

 CRTDetSim (fhicl::ParameterSet const &p)
 
 CRTDetSim (CRTDetSim const &)=delete
 
 CRTDetSim (CRTDetSim &&)=delete
 
CRTDetSimoperator= (CRTDetSim const &)=delete
 
CRTDetSimoperator= (CRTDetSim &&)=delete
 
void reconfigure (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 

Public Attributes

std::string fG4ModuleLabel
 

Private Attributes

CLHEP::HepRandomEngine & fEngine
 Reference to art-managed random-number engine. More...
 
double fG4RefTime
 Stores the G4 reference time. More...
 
CRTDetSimAlg fDetAlg
 Instance of the CRT detector simulation algorithm. More...
 

Detailed Description

Definition at line 31 of file CRTDetSim.h.

Constructor & Destructor Documentation

sbnd::crt::CRTDetSim::CRTDetSim ( fhicl::ParameterSet const &  p)
explicit

Definition at line 53 of file sbndcode/sbndcode/CRT/CRTDetSim_module.cc.

54  : EDProducer{p}
55  , fEngine(art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, "HepJamesRandom", "crt", p, "Seed"))
pdgs p
Definition: selectors.fcl:22
CLHEP::HepRandomEngine & fEngine
Reference to art-managed random-number engine.
Definition: CRTDetSim.h:46
sbnd::crt::CRTDetSim::CRTDetSim ( CRTDetSim const &  )
delete
sbnd::crt::CRTDetSim::CRTDetSim ( CRTDetSim &&  )
delete

Member Function Documentation

CRTDetSim& sbnd::crt::CRTDetSim::operator= ( CRTDetSim const &  )
delete
CRTDetSim& sbnd::crt::CRTDetSim::operator= ( CRTDetSim &&  )
delete
void sbnd::crt::CRTDetSim::produce ( art::Event &  e)
override

Definition at line 70 of file sbndcode/sbndcode/CRT/CRTDetSim_module.cc.

70  {
71 
72  std::unique_ptr<std::vector<sbnd::crt::FEBData> > FEBDataOut(new std::vector<sbnd::crt::FEBData>);
73  art::PtrMaker<sbnd::crt::FEBData> makeDataPtr(e);
74 
75  std::unique_ptr<std::vector<sim::AuxDetIDE> > auxDetIdes(new std::vector<sim::AuxDetIDE>);
76  art::PtrMaker<sim::AuxDetIDE> makeIdePtr(e);
77 
78  std::unique_ptr<art::Assns<sbnd::crt::FEBData, sim::AuxDetIDE, sbnd::crt::FEBTruthInfo>> Dataassn
79  (new art::Assns<sbnd::crt::FEBData, sim::AuxDetIDE, sbnd::crt::FEBTruthInfo>);
80 
81  // Handle for (truth) AuxDetSimChannels
82  art::Handle<std::vector<sim::AuxDetSimChannel> > channels;
83  e.getByLabel(fG4ModuleLabel, channels);
84 
85  if (!channels.isValid()) {
86  mf::LogWarning("CRTDetSim") << "No AuxDetSimChannel..." << std::endl;
87  }
88 
90 
91 
92  //
93  // Step 1: Construct Taggers
94  //
95  for(auto const& adsc : *channels) {
96 
97  if(adsc.AuxDetID() == UINT_MAX || adsc.AuxDetSensitiveID() == UINT_MAX) {
98  mf::LogWarning("CRTDetSim") << "AuxDetSimChannel with ID: UINT_MAX\n"
99  << "skipping channel...";
100  continue;
101  }
102 
103  if(adsc.AuxDetIDEs().size() > 0) {
104  mf::LogDebug("CRTDetSim") << "Adding AuxDetSimChannel with AuxDetID " << adsc.AuxDetID()
105  << ", AuxDetSensitiveID " << adsc.AuxDetSensitiveID() << std::endl;
106  fDetAlg.FillTaggers(adsc.AuxDetID(), adsc.AuxDetSensitiveID(), adsc.AuxDetIDEs());
107  }
108 
109  } // loop over AuxDetSimChannels
110 
111 
112  //
113  // Step 1: Apply Coincidence, deadtime, etc.
114  //
115 
117  std::vector<std::pair<sbnd::crt::FEBData, std::vector<sim::AuxDetIDE>>> data = fDetAlg.GetData();
118  std::vector<std::vector<int>> auxdata = fDetAlg.GetAuxData();
119 
120  //
121  // Step 3: Save output
122  //
123 
124  // for(auto const& dataPair : data){
125  for (size_t i = 0; i < data.size(); i++) {
126 
127  auto & dataPair = data[i];
128  auto & feb = dataPair.first;
129  auto & ides = dataPair.second;
130  auto & idxs = auxdata.at(i);
131 
132  FEBDataOut->push_back(feb);
133  art::Ptr<FEBData> dataPtr = makeDataPtr(FEBDataOut->size()-1);
134 
135  for(size_t j = 0; j < ides.size(); j++){
136  auto const& ide = ides[j];
137  auxDetIdes->push_back(ide);
138  FEBTruthInfo const feb_truth_info {idxs[j]};
139  mf::LogDebug("CRTDetSim") << "Adding " << idxs[j] << " to FEBTruthInfo." << std::endl;
140  art::Ptr<sim::AuxDetIDE> idePtr = makeIdePtr(auxDetIdes->size()-1);
141  Dataassn->addSingle(dataPtr, idePtr, feb_truth_info);
142  }
143  }
144 
145  mf::LogInfo("CRTDetSim") << "Number of FEBData objects produced: " << FEBDataOut->size() << "\n";
146 
147  e.put(std::move(FEBDataOut));
148  e.put(std::move(auxDetIdes));
149  e.put(std::move(Dataassn));
150 }
std::vector< std::pair< sbnd::crt::FEBData, std::vector< AuxDetIDE > > > GetData()
void FillTaggers(const uint32_t adid, const uint32_t adsid, std::vector< AuxDetIDE > ides)
std::string fG4ModuleLabel
Definition: CRTDetSim.h:42
std::vector< std::vector< int > > GetAuxData()
do i e
CRTDetSimAlg fDetAlg
Instance of the CRT detector simulation algorithm.
Definition: CRTDetSim.h:48
void sbnd::crt::CRTDetSim::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 48 of file sbndcode/sbndcode/CRT/CRTDetSim_module.cc.

48  {
49  fG4ModuleLabel = p.get<std::string>("G4ModuleLabel");
50 }
pdgs p
Definition: selectors.fcl:22
std::string fG4ModuleLabel
Definition: CRTDetSim.h:42

Member Data Documentation

CRTDetSimAlg sbnd::crt::CRTDetSim::fDetAlg
private

Instance of the CRT detector simulation algorithm.

Definition at line 48 of file CRTDetSim.h.

CLHEP::HepRandomEngine& sbnd::crt::CRTDetSim::fEngine
private

Reference to art-managed random-number engine.

Definition at line 46 of file CRTDetSim.h.

std::string sbnd::crt::CRTDetSim::fG4ModuleLabel

Definition at line 42 of file CRTDetSim.h.

double sbnd::crt::CRTDetSim::fG4RefTime
private

Stores the G4 reference time.

Definition at line 47 of file CRTDetSim.h.


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