LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
evgen::RadioGen Class Reference
Inheritance diagram for evgen::RadioGen:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 RadioGen (fhicl::ParameterSet const &pset)
 
virtual ~RadioGen ()
 
void produce (art::Event &evt)
 
void beginRun (art::Run &run)
 
void reconfigure (fhicl::ParameterSet const &p)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Types

typedef int ti_PDGID
 
typedef double td_Mass
 

Private Member Functions

void SampleOne (unsigned int i, simb::MCTruth &mct)
 
TLorentzVector dirCalc (double p, double m)
 
void readfile (std::string nuclide, std::string filename)
 
void samplespectrum (std::string nuclide, int &itype, double &t, double &m, double &p)
 
void Ar42Gamma2 (std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
 
void Ar42Gamma3 (std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
 
void Ar42Gamma4 (std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
 
void Ar42Gamma5 (std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
 
double samplefromth1d (TH1D *hist)
 

Private Attributes

std::vector< std::string > fNuclide
 List of nuclides to simulate. Example: "39Ar". More...
 
std::vector< std::string > fMaterial
 List of regexes of materials in which to generate the decays. Example: "LAr". More...
 
std::vector< double > fBq
 Radioactivity in Becquerels (decay per sec) per cubic cm. More...
 
std::vector< double > fT0
 Beginning of time window to simulate in ns. More...
 
std::vector< double > fT1
 End of time window to simulate in ns. More...
 
std::vector< double > fX0
 Bottom corner x position (cm) in world coordinates. More...
 
std::vector< double > fY0
 Bottom corner y position (cm) in world coordinates. More...
 
std::vector< double > fZ0
 Bottom corner z position (cm) in world coordinates. More...
 
std::vector< double > fX1
 Top corner x position (cm) in world coordinates. More...
 
std::vector< double > fY1
 Top corner y position (cm) in world coordinates. More...
 
std::vector< double > fZ1
 Top corner z position (cm) in world coordinates. More...
 
int trackidcounter
 Serial number for the MC track ID. More...
 
const double m_e = 0.000510998928
 
const double m_alpha = 3.727379240
 
const double m_neutron = 0.9395654133
 
std::vector< std::string > spectrumname
 
std::vector< TH1D * > alphaspectrum
 
std::vector< double > alphaintegral
 
std::vector< TH1D * > betaspectrum
 
std::vector< double > betaintegral
 
std::vector< TH1D * > gammaspectrum
 
std::vector< double > gammaintegral
 
std::vector< TH1D * > neutronspectrum
 
std::vector< double > neutronintegral
 

Detailed Description

Module to generate particles created by radiological decay, patterend off of SingleGen Currently it generates only in rectangular prisms oriented along the x,y,z axes

Definition at line 97 of file RadioGen_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

typedef double evgen::RadioGen::td_Mass
private

Definition at line 111 of file RadioGen_module.cc.

typedef int evgen::RadioGen::ti_PDGID
private

Definition at line 110 of file RadioGen_module.cc.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

evgen::RadioGen::RadioGen ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 177 of file RadioGen_module.cc.

178  {
179 
180  this->reconfigure(pset);
181 
182  // create a default random engine; obtain the random seed from NuRandomService,
183  // unless overridden in configuration with key "Seed"
185  ->createEngine(*this, pset, "Seed");
186 
187  produces< std::vector<simb::MCTruth> >();
188  produces< sumdata::RunData, art::InRun >();
189 
190  }
base_engine_t & createEngine(seed_t seed)
void reconfigure(fhicl::ParameterSet const &p)
evgen::RadioGen::~RadioGen ( )
virtual

Definition at line 193 of file RadioGen_module.cc.

194  {
195  }

Member Function Documentation

void evgen::RadioGen::Ar42Gamma2 ( std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &  v_prods)
private

Definition at line 692 of file RadioGen_module.cc.

692  {
693  ti_PDGID pdgid = 22; td_Mass m = 0.0; //we are writing gammas
694  std::vector<double> vd_p = {.0015246};//Momentum in GeV
695  for(auto p : vd_p){
696  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
697  v_prods.push_back(prods);
698  }
699  }
TLorentzVector dirCalc(double p, double m)
void evgen::RadioGen::Ar42Gamma3 ( std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &  v_prods)
private

Definition at line 700 of file RadioGen_module.cc.

700  {
701  ti_PDGID pdgid = 22; td_Mass m = 0.0; //we are writing gammas
702  std::vector<double> vd_p = {.0003126};
703  for(auto p : vd_p){
704  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
705  v_prods.push_back(prods);
706  }
707  Ar42Gamma2(v_prods);
708  }
TLorentzVector dirCalc(double p, double m)
void Ar42Gamma2(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void evgen::RadioGen::Ar42Gamma4 ( std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &  v_prods)
private

Definition at line 709 of file RadioGen_module.cc.

References art::RandomNumberGenerator::getEngine().

709  {
711  CLHEP::HepRandomEngine &engine = rng->getEngine();
712  CLHEP::RandFlat flat(engine);
713  ti_PDGID pdgid = 22; td_Mass m = 0.0; //we are writing gammas
714  double chan1 = (0.052 / (0.052+0.020) );
715  if(flat.fire()<chan1){
716  std::vector<double> vd_p = {.0008997};//Momentum in GeV
717  for(auto p : vd_p){
718  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
719  v_prods.push_back(prods);
720  }
721  Ar42Gamma2(v_prods);
722  }else{
723  std::vector<double> vd_p = {.0024243};//Momentum in GeV
724  for(auto p : vd_p){
725  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
726  v_prods.push_back(prods);
727  }
728  }
729  }
TLorentzVector dirCalc(double p, double m)
base_engine_t & getEngine() const
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
void Ar42Gamma2(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void evgen::RadioGen::Ar42Gamma5 ( std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &  v_prods)
private

Definition at line 730 of file RadioGen_module.cc.

References DEFINE_ART_MODULE, and art::RandomNumberGenerator::getEngine().

730  {
732  CLHEP::HepRandomEngine &engine = rng->getEngine();
733  CLHEP::RandFlat flat(engine);
734  ti_PDGID pdgid = 22; td_Mass m = 0.0; //we are writing gammas
735  double chan1 = ( 0.0033 / (0.0033 + 0.0201 + 0.041) ); double chan2 = ( 0.0201 / (0.0033 + 0.0201 + 0.041) );
736  double chanPick = flat.fire();
737  if(chanPick < chan1){
738  std::vector<double> vd_p = {0.000692, 0.001228};//Momentum in GeV
739  for(auto p : vd_p){
740  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
741  v_prods.push_back(prods);
742  }
743  Ar42Gamma2(v_prods);
744  }else if (chanPick<(chan1+chan2)){
745  std::vector<double> vd_p = {0.0010212};//Momentum in GeV
746  for(auto p : vd_p){
747  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
748  v_prods.push_back(prods);
749  }
750  Ar42Gamma4(v_prods);
751  }else{
752  std::vector<double> vd_p = {0.0019208};//Momentum in GeV
753  for(auto p : vd_p){
754  std::tuple<ti_PDGID, td_Mass, TLorentzVector> prods = std::make_tuple(pdgid, m, dirCalc(p,m));
755  v_prods.push_back(prods);
756  }
757  Ar42Gamma2(v_prods);
758  }
759  }
TLorentzVector dirCalc(double p, double m)
base_engine_t & getEngine() const
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
void Ar42Gamma2(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void Ar42Gamma4(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void evgen::RadioGen::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 257 of file RadioGen_module.cc.

References geo::GeometryCore::DetectorName(), and art::Run::put().

258  {
259 
260  // grab the geometry object to see what geometry we are using
261 
263  std::unique_ptr<sumdata::RunData> runcol(new sumdata::RunData(geo->DetectorName()));
264  run.put(std::move(runcol));
265 
266  return;
267  }
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:148
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Namespace collecting geometry-related classes utilities.
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
TLorentzVector evgen::RadioGen::dirCalc ( double  p,
double  m 
)
private

Definition at line 416 of file RadioGen_module.cc.

References art::RandomNumberGenerator::getEngine().

416  {
418  CLHEP::HepRandomEngine &engine = rng->getEngine();
419  CLHEP::RandFlat flat(engine);
420  // isotropic production angle for the decay product
421  double costheta = (2.0*flat.fire() - 1.0);
422  if (costheta < -1.0) costheta = -1.0;
423  if (costheta > 1.0) costheta = 1.0;
424  double sintheta = sqrt(1.0-costheta*costheta);
425  double phi = 2.0*M_PI*flat.fire();
426  TLorentzVector pvec(p*sintheta*std::cos(phi),
427  p*sintheta*std::sin(phi),
428  p*costheta,
429  std::sqrt(p*p+m*m));
430  return pvec;
431  }
base_engine_t & getEngine() const
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References B, and art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
Int_t B
Definition: plot.C:25
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void evgen::RadioGen::produce ( art::Event evt)
virtual

unique_ptr allows ownership to be transferred to the art::Event after the put statement

Implements art::EDProducer.

Definition at line 270 of file RadioGen_module.cc.

References simb::kSingleParticle, LOG_DEBUG, art::Event::put(), and simb::MCTruth::SetOrigin().

271  {
272 
274  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
275 
276  simb::MCTruth truth;
278 
279  trackidcounter = -1;
280  for (unsigned int i=0; i<fNuclide.size(); ++i) {
281  SampleOne(i,truth);
282  }//end loop over nuclides
283 
284  LOG_DEBUG("RadioGen") << truth;
285  truthcol->push_back(truth);
286  evt.put(std::move(truthcol));
287  return;
288  }
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:78
std::vector< std::string > fNuclide
List of nuclides to simulate. Example: "39Ar".
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
single particles thrown at the detector
Definition: MCTruth.h:24
int trackidcounter
Serial number for the MC track ID.
void SampleOne(unsigned int i, simb::MCTruth &mct)
#define LOG_DEBUG(id)
Event generator information.
Definition: MCTruth.h:30
void evgen::RadioGen::readfile ( std::string  nuclide,
std::string  filename 
)
private

Definition at line 436 of file RadioGen_module.cc.

References f, and y.

437  {
438  int ifound = 0;
439  for (size_t i=0; i<fNuclide.size(); i++)
440  {
441  if (fNuclide[i] == nuclide){ //This check makes sure that the nuclide we are searching for is in fact in our fNuclide list. Ar42 handeled separately.
442  ifound = 1;
443  break;
444  } //End If nuclide is in our list. Next is the special case of Ar42
445  else if ( (std::regex_match(nuclide, std::regex( "42Ar.*" )) ) && fNuclide[i]=="42Ar" ){
446  ifound = 1;
447  break;
448  }
449  }
450  if (ifound == 0) return;
451 
452  Bool_t addStatus = TH1::AddDirectoryStatus();
453  TH1::AddDirectory(kFALSE); // cloned histograms go in memory, and aren't deleted when files are closed.
454  // be sure to restore this state when we're out of the routine.
455 
456 
457  spectrumname.push_back(nuclide);
458  cet::search_path sp("FW_SEARCH_PATH");
459  std::string fn2 = "Radionuclides/";
460  fn2 += filename;
461  std::string fullname;
462  sp.find_file(fn2, fullname);
463  struct stat sb;
464  if (fullname.empty() || stat(fullname.c_str(), &sb)!=0)
465  throw cet::exception("RadioGen") << "Input spectrum file "
466  << fn2
467  << " not found in FW_SEARCH_PATH!\n";
468 
469  TFile f(fullname.c_str(),"READ");
470  TGraph *alphagraph = (TGraph*) f.Get("Alphas");
471  TGraph *betagraph = (TGraph*) f.Get("Betas");
472  TGraph *gammagraph = (TGraph*) f.Get("Gammas");
473  TGraph *neutrongraph = (TGraph*) f.Get("Neutrons");
474 
475  if (alphagraph)
476  {
477  int np = alphagraph->GetN();
478  double *y = alphagraph->GetY();
479  std::string name;
480  name = "RadioGen_";
481  name += nuclide;
482  name += "_Alpha";
483  TH1D *alphahist = (TH1D*) new TH1D(name.c_str(),"Alpha Spectrum",np,0,np);
484  for (int i=0; i<np; i++)
485  {
486  alphahist->SetBinContent(i+1,y[i]);
487  alphahist->SetBinError(i+1,0);
488  }
489  alphaspectrum.push_back(alphahist);
490  alphaintegral.push_back(alphahist->Integral());
491  }
492  else
493  {
494  alphaspectrum.push_back(0);
495  alphaintegral.push_back(0);
496  }
497 
498 
499  if (betagraph)
500  {
501  int np = betagraph->GetN();
502 
503  double *y = betagraph->GetY();
504  std::string name;
505  name = "RadioGen_";
506  name += nuclide;
507  name += "_Beta";
508  TH1D *betahist = (TH1D*) new TH1D(name.c_str(),"Beta Spectrum",np,0,np);
509 
510  for (int i=0; i<np; i++)
511  {
512  betahist->SetBinContent(i+1,y[i]);
513  betahist->SetBinError(i+1,0);
514  }
515  betaspectrum.push_back(betahist);
516  betaintegral.push_back(betahist->Integral());
517  }
518  else
519  {
520  betaspectrum.push_back(0);
521  betaintegral.push_back(0);
522  }
523 
524  if (gammagraph)
525  {
526  int np = gammagraph->GetN();
527  double *y = gammagraph->GetY();
528  std::string name;
529  name = "RadioGen_";
530  name += nuclide;
531  name += "_Gamma";
532  TH1D *gammahist = (TH1D*) new TH1D(name.c_str(),"Gamma Spectrum",np,0,np);
533  for (int i=0; i<np; i++)
534  {
535  gammahist->SetBinContent(i+1,y[i]);
536  gammahist->SetBinError(i+1,0);
537  }
538  gammaspectrum.push_back(gammahist);
539  gammaintegral.push_back(gammahist->Integral());
540  }
541  else
542  {
543  gammaspectrum.push_back(0);
544  gammaintegral.push_back(0);
545  }
546 
547  if (neutrongraph)
548  {
549  int np = neutrongraph->GetN();
550  double *y = neutrongraph->GetY();
551  std::string name;
552  name = "RadioGen_";
553  name += nuclide;
554  name += "_Neutron";
555  TH1D *neutronhist = (TH1D*) new TH1D(name.c_str(),"Neutron Spectrum",np,0,np);
556  for (int i=0; i<np; i++)
557  {
558  neutronhist->SetBinContent(i+1,y[i]);
559  neutronhist->SetBinError(i+1,0);
560  }
561  neutronspectrum.push_back(neutronhist);
562  neutronintegral.push_back(neutronhist->Integral());
563  }
564  else
565  {
566  neutronspectrum.push_back(0);
567  neutronintegral.push_back(0);
568  }
569 
570  f.Close();
571  TH1::AddDirectory(addStatus);
572 
573  double total = alphaintegral.back() + betaintegral.back() + gammaintegral.back() + neutronintegral.back();
574  if (total>0)
575  {
576  alphaintegral.back() /= total;
577  betaintegral.back() /= total;
578  gammaintegral.back() /= total;
579  neutronintegral.back() /= total;
580  }
581  }
std::vector< std::string > fNuclide
List of nuclides to simulate. Example: "39Ar".
Float_t y
Definition: compare.C:6
std::vector< TH1D * > alphaspectrum
std::vector< double > neutronintegral
std::vector< std::string > spectrumname
std::vector< TH1D * > neutronspectrum
TFile f
Definition: plotHisto.C:6
std::vector< TH1D * > betaspectrum
std::vector< double > alphaintegral
std::vector< double > betaintegral
std::vector< double > gammaintegral
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< TH1D * > gammaspectrum
void evgen::RadioGen::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 198 of file RadioGen_module.cc.

References fhicl::ParameterSet::get().

199  {
200  // do not put seed in reconfigure because we don't want to reset
201  // the seed midstream -- same as SingleGen
202 
203  fNuclide = p.get< std::vector<std::string>>("Nuclide");
204  fMaterial = p.get< std::vector<std::string>>("Material");
205  fBq = p.get< std::vector<double> >("BqPercc");
206  fT0 = p.get< std::vector<double> >("T0");
207  fT1 = p.get< std::vector<double> >("T1");
208  fX0 = p.get< std::vector<double> >("X0");
209  fY0 = p.get< std::vector<double> >("Y0");
210  fZ0 = p.get< std::vector<double> >("Z0");
211  fX1 = p.get< std::vector<double> >("X1");
212  fY1 = p.get< std::vector<double> >("Y1");
213  fZ1 = p.get< std::vector<double> >("Z1");
214 
215  // check for consistency of vector sizes
216 
217  unsigned int nsize = fNuclide.size();
218  if ( fMaterial.size() != nsize ) throw cet::exception("RadioGen") << "Different size Material vector and Nuclide vector\n";
219  if ( fBq.size() != nsize ) throw cet::exception("RadioGen") << "Different size Bq vector and Nuclide vector\n";
220  if ( fT0.size() != nsize ) throw cet::exception("RadioGen") << "Different size T0 vector and Nuclide vector\n";
221  if ( fT1.size() != nsize ) throw cet::exception("RadioGen") << "Different size T1 vector and Nuclide vector\n";
222  if ( fX0.size() != nsize ) throw cet::exception("RadioGen") << "Different size X0 vector and Nuclide vector\n";
223  if ( fY0.size() != nsize ) throw cet::exception("RadioGen") << "Different size Y0 vector and Nuclide vector\n";
224  if ( fZ0.size() != nsize ) throw cet::exception("RadioGen") << "Different size Z0 vector and Nuclide vector\n";
225  if ( fX1.size() != nsize ) throw cet::exception("RadioGen") << "Different size X1 vector and Nuclide vector\n";
226  if ( fY1.size() != nsize ) throw cet::exception("RadioGen") << "Different size Y1 vector and Nuclide vector\n";
227  if ( fZ1.size() != nsize ) throw cet::exception("RadioGen") << "Different size Z1 vector and Nuclide vector\n";
228 
229  for(std::string & nuclideName : fNuclide){
230  if(nuclideName=="39Ar" ){readfile("39Ar","Argon_39.root") ;}
231  else if(nuclideName=="60Co" ){readfile("60Co","Cobalt_60.root") ;}
232  else if(nuclideName=="85Kr" ){readfile("85Kr","Krypton_85.root") ;}
233  else if(nuclideName=="40K" ){readfile("40K","Potassium_40.root") ;}
234  else if(nuclideName=="232Th"){readfile("232Th","Thorium_232.root");}
235  else if(nuclideName=="238U" ){readfile("238U","Uranium_238.root") ;}
236  else if(nuclideName=="222Rn"){continue;} //Rn222 is handeled separately later
237  else if(nuclideName=="59Ni"){continue;} //Rn222 is handeled separately later
238  else if(nuclideName=="42Ar" ){
239  readfile("42Ar_1", "Argon_42_1.root"); //Each possible beta decay mode of Ar42 is given it's own .root file for now.
240  readfile("42Ar_2", "Argon_42_2.root"); //This allows us to know which decay chain to follow for the dexcitation gammas.
241  readfile("42Ar_3", "Argon_42_3.root"); //The dexcitation gammas are not included in the root files as we want to
242  readfile("42Ar_4", "Argon_42_4.root"); //probabilistically simulate the correct coincident gammas, which we cannot guarantee
243  readfile("42Ar_5", "Argon_42_5.root"); //by sampling a histogram.
244  continue;
245  } //Ar42 is handeled separately later
246  else{
247  std::string searchName = nuclideName;
248  searchName+=".root";
249  readfile(nuclideName,searchName);
250  }
251  }
252 
253  return;
254  }
std::vector< double > fZ0
Bottom corner z position (cm) in world coordinates.
std::vector< std::string > fNuclide
List of nuclides to simulate. Example: "39Ar".
void readfile(std::string nuclide, std::string filename)
std::vector< double > fT1
End of time window to simulate in ns.
std::vector< double > fY1
Top corner y position (cm) in world coordinates.
std::vector< double > fZ1
Top corner z position (cm) in world coordinates.
std::vector< double > fT0
Beginning of time window to simulate in ns.
std::vector< std::string > fMaterial
List of regexes of materials in which to generate the decays. Example: "LAr".
std::vector< double > fX0
Bottom corner x position (cm) in world coordinates.
std::vector< double > fBq
Radioactivity in Becquerels (decay per sec) per cubic cm.
std::vector< double > fX1
Top corner x position (cm) in world coordinates.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< double > fY0
Bottom corner y position (cm) in world coordinates.
double evgen::RadioGen::samplefromth1d ( TH1D *  hist)
private

Definition at line 655 of file RadioGen_module.cc.

References art::RandomNumberGenerator::getEngine(), and x.

656  {
658  CLHEP::HepRandomEngine &engine = rng->getEngine();
659  CLHEP::RandFlat flat(engine);
660 
661  int nbinsx = hist->GetNbinsX();
662  std::vector<double> partialsum;
663  partialsum.resize(nbinsx+1);
664  partialsum[0] = 0;
665 
666  for (int i=1;i<=nbinsx;i++)
667  {
668  double hc = hist->GetBinContent(i);
669  if ( hc < 0) throw cet::exception("RadioGen") << "Negative bin: " << i << " " << hist->GetName() << "\n";
670  partialsum[i] = partialsum[i-1] + hc;
671  }
672  double integral = partialsum[nbinsx];
673  if (integral == 0) return 0;
674  // normalize to unit sum
675  for (int i=1;i<=nbinsx;i++) partialsum[i] /= integral;
676 
677  double r1 = flat.fire();
678  int ibin = TMath::BinarySearch(nbinsx,&(partialsum[0]),r1);
679  Double_t x = hist->GetBinLowEdge(ibin+1);
680  if (r1 > partialsum[ibin]) x +=
681  hist->GetBinWidth(ibin+1)*(r1-partialsum[ibin])/(partialsum[ibin+1] - partialsum[ibin]);
682  return x;
683  }
Float_t x
Definition: compare.C:6
base_engine_t & getEngine() const
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
TH2F * hist
Definition: plot.C:136
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void evgen::RadioGen::SampleOne ( unsigned int  i,
simb::MCTruth mct 
)
private

Definition at line 293 of file RadioGen_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), energy, art::RandomNumberGenerator::getEngine(), part, and geo::GeometryCore::ROOTGeoManager().

293  {
294 
296  TGeoManager *geomanager = geo->ROOTGeoManager();
297 
298  // get the random number generator service and make some CLHEP generators
300  CLHEP::HepRandomEngine &engine = rng->getEngine();
301  CLHEP::RandFlat flat(engine);
302  CLHEP::RandPoisson poisson(engine);
303 
304  // figure out how many decays to generate, assuming that the entire prism consists of the radioactive material.
305  // we will skip over decays in other materials later.
306 
307  double rate = fabs( fBq[i] * (fT1[i] - fT0[i]) * (fX1[i] - fX0[i]) * (fY1[i] - fY0[i]) * (fZ1[i] - fZ0[i]) ) / 1.0E9;
308  long ndecays = poisson.shoot(rate);
309 
310  for (unsigned int idecay=0; idecay<ndecays; idecay++)
311  {
312  // generate just one particle at a time. Need a little recoding if a radioactive
313  // decay generates multiple daughters that need simulation
314  // uniformly distributed in position and time
315  //
316  // JStock: Leaving this as a single position for the decay products. For now I will assume they all come from the same spot.
317  TLorentzVector pos( fX0[i] + flat.fire()*(fX1[i] - fX0[i]),
318  fY0[i] + flat.fire()*(fY1[i] - fY0[i]),
319  fZ0[i] + flat.fire()*(fZ1[i] - fZ0[i]),
320  fT0[i] + flat.fire()*(fT1[i] - fT0[i]) );
321 
322  // discard decays that are not in the proper material
323  std::string volmaterial = geomanager->FindNode(pos.X(),pos.Y(),pos.Z())->GetMedium()->GetMaterial()->GetName();
324  //mf::LogDebug("RadioGen") << "Position: " << pos.X() << " " << pos.Y() << " " << pos.Z() << " " << pos.T() << " " << volmaterial << " " << fMaterial[i] << std::endl;
325  if ( ! std::regex_match(volmaterial, std::regex(fMaterial[i])) ) continue;
326  //mf::LogDebug("RadioGen") << "Decay accepted" << std::endl;
327 
328  //Moved pdgid into the next statement, so that it is localized.
329  // electron=11, photon=22, alpha = 1000020040, neutron = 2112
330 
331  //JStock: Allow us to have different particles from the same decay. This requires multiple momenta.
332  std::vector<std::tuple<ti_PDGID, td_Mass, TLorentzVector>> v_prods; //(First is for PDGID, second is mass, third is Momentum)
333 
334  if (fNuclide[i] == "222Rn") // Treat 222Rn separately
335  {
336  double p=0; double t=0.00548952; td_Mass m=m_alpha; ti_PDGID pdgid=1000020040; //td_Mass = double. ti_PDGID = int;
337  double energy = t + m;
338  double p2 = energy*energy - m*m;
339  if (p2 > 0) p = TMath::Sqrt(p2);
340  else p = 0;
341  //Make TLorentzVector and push it to the back of v_prods.
342  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
343  v_prods.push_back(partMassMom);
344  }//End special case RN222
345  else if(fNuclide[i] == "59Ni"){ //Treat 59Ni Calibration Source separately (as I haven't made a spectrum for it, and ultimately it should be handeled with multiple particle outputs.
346  double p=0.008997; td_Mass m=0; ti_PDGID pdgid=22; // td_Mas=double. ti_PDFID=int. Assigning p directly, as t=p for gammas.
347  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
348  v_prods.push_back(partMassMom);
349  }//end special case Ni59 calibration source
350  else if(fNuclide[i] == "42Ar"){ // Spot for special treatment of Ar42.
351  double p=0; double t=0; td_Mass m = 0; ti_PDGID pdgid=0; //td_Mass = double. ti_PDGID = int;
352  double bSelect = flat.fire(); //Make this a random number from 0 to 1.
353  if(bSelect<0.819){ //beta channel 1. No Gamma. beta Q value 3525.22 keV
354  samplespectrum("42Ar_1", pdgid, t, m, p);
355  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
356  v_prods.push_back(partMassMom);
357  //No gamma here.
358  }else if(bSelect<0.9954){ //beta channel 2. 1 Gamma (1524.6 keV). beta Q value 2000.62
359  samplespectrum("42Ar_2", pdgid, t, m, p);
360  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
361  v_prods.push_back(partMassMom);
362  Ar42Gamma2(v_prods);
363  }else if(bSelect<0.9988){ //beta channel 3. 1 Gamma Channel. 312.6 keV + gamma 2. beta Q value 1688.02 keV
364  samplespectrum("42Ar_3", pdgid, t, m, p);
365  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
366  v_prods.push_back(partMassMom);
367  Ar42Gamma3(v_prods);
368  }else if(bSelect<0.9993){ //beta channel 4. 2 Gamma Channels. Either 899.7 keV (i 0.052) + gamma 2 or 2424.3 keV (i 0.020). beta Q value 1100.92 keV
369  samplespectrum("42Ar_4", pdgid, t, m, p);
370  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
371  v_prods.push_back(partMassMom);
372  Ar42Gamma4(v_prods);
373  }else{ //beta channel 5. 3 gamma channels. 692.0 keV + 1228.0 keV + Gamma 2 (i 0.0033) ||OR|| 1021.2 keV + gamma 4 (i 0.0201) ||OR|| 1920.8 keV + gamma 2 (i 0.041). beta Q value 79.82 keV
374  samplespectrum("42Ar_5", pdgid, t, m, p);
375  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
376  v_prods.push_back(partMassMom);
377  Ar42Gamma5(v_prods);
378  }
379  //Add beta.
380  //Call gamma function for beta mode.
381  }
382  else{ //General Case.
383  double p=0; double t=0; td_Mass m = 0; ti_PDGID pdgid=0; //td_Mass = double. ti_PDGID = int;
384  samplespectrum(fNuclide[i],pdgid,t,m,p);
385  std::tuple<ti_PDGID, td_Mass, TLorentzVector> partMassMom = std::make_tuple(pdgid, m, dirCalc(p,m));
386  v_prods.push_back(partMassMom);
387  }//end else (not RN or other special case
388 
389  //JStock: Modify this to now loop over the v_prods.
390  for(auto prodEntry : v_prods){
391  // set track id to a negative serial number as these are all primary particles and have id <= 0
392  int trackid = trackidcounter;
393  ti_PDGID pdgid = std::get<0>(prodEntry);
394  td_Mass m = std::get<1>(prodEntry);
395  TLorentzVector pvec = std::get<2>(prodEntry);
396  trackidcounter--;
397  std::string primary("primary");
398 
399  // alpha particles need a little help since they're not in the TDatabasePDG table
400  // // so don't rely so heavily on default arguments to the MCParticle constructor
401  if (pdgid == 1000020040){
402  simb::MCParticle part(trackid, pdgid, primary,-1,m,1);
403  part.AddTrajectoryPoint(pos, pvec);
404  mct.Add(part);
405  }// end "If alpha"
406  else{
407  simb::MCParticle part(trackid, pdgid, primary);
408  part.AddTrajectoryPoint(pos, pvec);
409  mct.Add(part);
410  }// end All standard cases.
411  }//End Loop over all particles produces in this single decay.
412  }
413  }
TLorentzVector dirCalc(double p, double m)
std::vector< double > fZ0
Bottom corner z position (cm) in world coordinates.
std::vector< std::string > fNuclide
List of nuclides to simulate. Example: "39Ar".
void Ar42Gamma5(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void Add(simb::MCParticle &part)
Definition: MCTruth.h:77
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
base_engine_t & getEngine() const
std::vector< double > fT1
End of time window to simulate in ns.
std::vector< double > fY1
Top corner y position (cm) in world coordinates.
std::vector< double > fZ1
Top corner z position (cm) in world coordinates.
TString part[npart]
Definition: Style.C:32
int trackidcounter
Serial number for the MC track ID.
double energy
Definition: plottest35.C:25
void Ar42Gamma3(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
void samplespectrum(std::string nuclide, int &itype, double &t, double &m, double &p)
const double m_alpha
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
void Ar42Gamma2(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
std::vector< double > fT0
Beginning of time window to simulate in ns.
void Ar42Gamma4(std::vector< std::tuple< ti_PDGID, td_Mass, TLorentzVector >> &v_prods)
std::vector< std::string > fMaterial
List of regexes of materials in which to generate the decays. Example: "LAr".
std::vector< double > fX0
Bottom corner x position (cm) in world coordinates.
std::vector< double > fBq
Radioactivity in Becquerels (decay per sec) per cubic cm.
Namespace collecting geometry-related classes utilities.
std::vector< double > fX1
Top corner x position (cm) in world coordinates.
std::vector< double > fY0
Bottom corner y position (cm) in world coordinates.
void evgen::RadioGen::samplespectrum ( std::string  nuclide,
int &  itype,
double &  t,
double &  m,
double &  p 
)
private

Definition at line 584 of file RadioGen_module.cc.

References e, and art::RandomNumberGenerator::getEngine().

585  {
586 
588  CLHEP::HepRandomEngine &engine = rng->getEngine();
589  CLHEP::RandFlat flat(engine);
590 
591  int inuc = -1;
592  for (size_t i=0; i<spectrumname.size(); i++)
593  {
594  if (nuclide == spectrumname[i])
595  {
596  inuc = i;
597  break;
598  }
599  }
600  if (inuc == -1)
601  {
602  t=0; // throw an exception in the future
603  itype = 0;
604  throw cet::exception("RadioGen") << "Ununderstood nuclide: " << nuclide << "\n";
605  }
606 
607  double rtype = flat.fire();
608 
609  itype = -1;
610  m = 0;
611  p = 0;
612  for (int itry=0;itry<10;itry++) // maybe a tiny normalization issue with a sum of 0.99999999999 or something, so try a few times.
613  {
614  if (rtype <= alphaintegral[inuc] && alphaspectrum[inuc] != 0)
615  {
616  itype = 1000020040; // alpha
617  m = m_alpha;
618  t = samplefromth1d(alphaspectrum[inuc])/1000000.0;
619  }
620  else if (rtype <= alphaintegral[inuc]+betaintegral[inuc] && betaspectrum[inuc] != 0)
621  {
622  itype = 11; // beta
623  m = m_e;
624  t = samplefromth1d(betaspectrum[inuc])/1000000.0;
625  }
626  else if ( rtype <= alphaintegral[inuc] + betaintegral[inuc] + gammaintegral[inuc] && gammaspectrum[inuc] != 0)
627  {
628  itype = 22; // gamma
629  m = 0;
630  t = samplefromth1d(gammaspectrum[inuc])/1000000.0;
631  }
632  else if( neutronspectrum[inuc] != 0)
633  {
634  itype = 2112;
635  m = m_neutron;
636  t = samplefromth1d(neutronspectrum[inuc])/1000000.0;
637  }
638  if (itype >= 0) break;
639  }
640  if (itype == -1)
641  {
642  throw cet::exception("RadioGen") << "Normalization problem with nuclide: " << nuclide << "\n";
643  }
644  double e = t + m;
645  p = e*e - m*m;
646  if (p>=0)
647  { p = TMath::Sqrt(p); }
648  else
649  { p=0; }
650  }
const double m_e
std::vector< TH1D * > alphaspectrum
std::vector< std::string > spectrumname
std::vector< TH1D * > neutronspectrum
std::vector< TH1D * > betaspectrum
base_engine_t & getEngine() const
std::vector< double > alphaintegral
const double m_alpha
std::vector< double > betaintegral
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
double samplefromth1d(TH1D *hist)
Float_t e
Definition: plot.C:34
std::vector< double > gammaintegral
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< TH1D * > gammaspectrum
const double m_neutron
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

std::vector<double> evgen::RadioGen::alphaintegral
private

Definition at line 163 of file RadioGen_module.cc.

std::vector<TH1D*> evgen::RadioGen::alphaspectrum
private

Definition at line 162 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::betaintegral
private

Definition at line 165 of file RadioGen_module.cc.

std::vector<TH1D*> evgen::RadioGen::betaspectrum
private

Definition at line 164 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fBq
private

Radioactivity in Becquerels (decay per sec) per cubic cm.

Definition at line 141 of file RadioGen_module.cc.

std::vector<std::string> evgen::RadioGen::fMaterial
private

List of regexes of materials in which to generate the decays. Example: "LAr".

Definition at line 140 of file RadioGen_module.cc.

std::vector<std::string> evgen::RadioGen::fNuclide
private

List of nuclides to simulate. Example: "39Ar".

Definition at line 139 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fT0
private

Beginning of time window to simulate in ns.

Definition at line 142 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fT1
private

End of time window to simulate in ns.

Definition at line 143 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fX0
private

Bottom corner x position (cm) in world coordinates.

Definition at line 144 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fX1
private

Top corner x position (cm) in world coordinates.

Definition at line 147 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fY0
private

Bottom corner y position (cm) in world coordinates.

Definition at line 145 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fY1
private

Top corner y position (cm) in world coordinates.

Definition at line 148 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fZ0
private

Bottom corner z position (cm) in world coordinates.

Definition at line 146 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::fZ1
private

Top corner z position (cm) in world coordinates.

Definition at line 149 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::gammaintegral
private

Definition at line 167 of file RadioGen_module.cc.

std::vector<TH1D*> evgen::RadioGen::gammaspectrum
private

Definition at line 166 of file RadioGen_module.cc.

const double evgen::RadioGen::m_alpha = 3.727379240
private

Definition at line 158 of file RadioGen_module.cc.

const double evgen::RadioGen::m_e = 0.000510998928
private

Definition at line 157 of file RadioGen_module.cc.

const double evgen::RadioGen::m_neutron = 0.9395654133
private

Definition at line 159 of file RadioGen_module.cc.

std::vector<double> evgen::RadioGen::neutronintegral
private

Definition at line 169 of file RadioGen_module.cc.

std::vector<TH1D*> evgen::RadioGen::neutronspectrum
private

Definition at line 168 of file RadioGen_module.cc.

std::vector<std::string> evgen::RadioGen::spectrumname
private

Definition at line 161 of file RadioGen_module.cc.

int evgen::RadioGen::trackidcounter
private

Serial number for the MC track ID.

Definition at line 150 of file RadioGen_module.cc.


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