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

Public Member Functions

 BlipMaker (fhicl::ParameterSet const &pset)
 
void produce (art::Event &evt)
 
- 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)
 

Private Attributes

int m_count
 
std::vector< double > m_head
 
std::vector< double > m_tail
 
double m_time
 
double m_charge
 
double m_step
 

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 11 of file BlipMaker_module.cc.

Constructor & Destructor Documentation

bogoblip::BlipMaker::BlipMaker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 45 of file BlipMaker_module.cc.

46  : EDProducer{pset}
47  , m_count(0)
48  , m_head {pset.get< std::vector<double> >("Head", {100.,0.,0.})}
49  , m_tail {pset.get< std::vector<double> >("Tail", {50.,10.,50.})}
50  , m_time {pset.get< double >("Time", 0.0)}
51  , m_charge {pset.get< double >("ElectronPerCm", 50000)}
52  , m_step {pset.get< double >("StepSize", 0.1)}
53 {
54  produces< std::vector<sim::SimEnergyDeposit> >(instance);
55 }
std::vector< double > m_head
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
const std::string instance
std::vector< double > m_tail

Member Function Documentation

void bogoblip::BlipMaker::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 58 of file BlipMaker_module.cc.

59 {
60  ++m_count;
61 
62  std::cout << "head: " << m_head.at(0) << " " << m_head.at(1) << " " << m_head.at(2) << std::endl;
63  std::cout << "tail: " << m_tail.at(0) << " " << m_tail.at(1) << " " << m_tail.at(2) << std::endl;
64  std::cout << "time: " << m_time << " e/cm: " << m_charge << " step: " << m_step << std::endl;
65 
66  auto out = std::make_unique< std::vector<sim::SimEnergyDeposit> >();
67 
68  int nphotons = 0;
69  const int nelepercm = m_charge; // 50000;
70  const double mevpercm = 2.0;
71 
72  double t0 = 0.;
73  double t1 = 0.;
74  int trackid = 0;
75 
76  // implicit units are cm, ns and MeV.
77  sim::SimEnergyDeposit::Point_t start = {m_head.at(0), m_head.at(1), m_head.at(2)}; // {100.,0.,0.};
78  sim::SimEnergyDeposit::Point_t end = {m_tail.at(0), m_tail.at(1), m_tail.at(2)}; // {150.,10.,50.};
79  const auto vdiff = end-start;
80  const auto vlen = sqrt(vdiff.Mag2());
81  const auto vdir = vdiff.unit();
82 
83  const double stepsize = m_step; // 0.1; // cm
84  const int nsteps = vlen/stepsize;
85 
86  // larsoft works in ns
87  const double ns = 1.0;
88  // const double us = 1000.0*ns;
89  // const double ms = 1000.0*us;
90 
91  // MB: WCT sim should cut the first, the second should just be on
92  // the edge of time acceptance. The last two bracket the BNB beam
93  // gate.
94  for (double jump : {m_time * ns} /*{ -1.6*ms, -1*ms, +3125*ns, (3125+1600)*ns, }*/) {
95  sim::SimEnergyDeposit::Point_t last = start;
96  for (int istep=1; istep<nsteps; ++istep) {
97  const sim::SimEnergyDeposit::Point_t next(start + stepsize*istep*vdir);
98  //std::cerr << last << " -> " << next << "\n";
99  out->emplace_back(sim::SimEnergyDeposit(nphotons,
100  stepsize * nelepercm,
101  1.0, //scintillatin yield ratio
102  stepsize * mevpercm,
103  last, next,
104  jump + t0,
105  jump + t1, trackid));
106  last = next;
107  }
108  }
109 
110  std::cerr << "BlipMaker making " << out->size() << " depos to instance: " << instance << std::endl;
111 
112 
113  event.put(std::move(out), instance);
114 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
code to link reconstructed objects back to the MC truth information
std::vector< double > m_head
const std::string instance
def move(depos, offset)
Definition: depos.py:107
std::vector< double > m_tail
Energy deposition in the active material.
QAsciiDict< Entry > ns
QTextStream & endl(QTextStream &s)

Member Data Documentation

double bogoblip::BlipMaker::m_charge
private

Definition at line 29 of file BlipMaker_module.cc.

int bogoblip::BlipMaker::m_count
private

Definition at line 24 of file BlipMaker_module.cc.

std::vector<double> bogoblip::BlipMaker::m_head
private

Definition at line 26 of file BlipMaker_module.cc.

double bogoblip::BlipMaker::m_step
private

Definition at line 30 of file BlipMaker_module.cc.

std::vector<double> bogoblip::BlipMaker::m_tail
private

Definition at line 27 of file BlipMaker_module.cc.

double bogoblip::BlipMaker::m_time
private

Definition at line 28 of file BlipMaker_module.cc.


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