LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evgen::MUSUN Class Reference

module to produce single or multiple specified particles in the detector More...

Inheritance diagram for evgen::MUSUN:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 MUSUN (fhicl::ParameterSet const &pset)
 
void produce (art::Event &evt)
 
void beginJob ()
 
void beginRun (art::Run &run)
 
void endRun (art::Run &run)
 
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)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
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)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
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 ()
 

Private Member Functions

void SampleOne (unsigned int i, simb::MCTruth &mct, CLHEP::HepRandomEngine &engine)
 
void initialization (double theta1, double theta2, double phi1, double phi2, int figflag, double s_hor, double s_ver1, double s_ver2, double &FI)
 
void sampling (double &E, double &theta, double &phi, double &dep, CLHEP::HepRandomEngine &engine)
 

Private Attributes

CLHEP::HepRandomEngine & fEngine
 art-managed random-number engine More...
 
int fPDG
 PDG code of particles to generate. More...
 
double fChargeRatio
 Charge ratio of particle / anti-particle. More...
 
std::string fInputDir
 Input Directory. More...
 
std::string fInputFile1
 Input File 1. More...
 
std::string fInputFile2
 Input File 2. More...
 
std::string fInputFile3
 Input File 3. More...
 
double fCavernAngle
 Angle of the detector from the North to the East. More...
 
double fRockDensity
 
double fEmin
 Minimum Kinetic Energy (GeV) More...
 
double fEmax
 Maximum Kinetic Energy (GeV) More...
 
double fThetamin
 Minimum theta. More...
 
double fThetamax
 Maximum theta. More...
 
double fPhimin
 Minimum phi. More...
 
double fPhimax
 Maximum phi. More...
 
int figflag
 If want sampled from sphere or parallelepiped. More...
 
double fXmin
 Minimum X position. More...
 
double fYmin
 Minimum Y position. More...
 
double fZmin
 Minimum Z position. More...
 
double fXmax
 Maximum X position. More...
 
double fYmax
 Maximum Y position. More...
 
double fZmax
 Maximum Z position. More...
 
double fDetRotX
 How much the detector should be rotated around X axis (rotates the coordinate system clockwise)) More...
 
double fDetRotY
 How much the detector should be rotated around Y axis (rotates the coordinate system clockwise)) More...
 
double fDetRotZ
 How much the detector should be rotated around Z axis (rotates the coordinate system clockwise)) More...
 
double fT0
 Central t position (ns) in world coordinates. More...
 
double fSigmaT
 Variation in t position (ns) More...
 
int fTDist
 How to distribute t (gaus, or uniform) More...
 
int PdgCode
 
double Energy
 
double phi
 
double theta
 
double dep
 
double Time
 
double Momentum
 
double px0
 
double py0
 
double pz0
 
double x0
 
double y0
 
double z0
 
double cx
 
double cy
 
double cz
 
double FI = 0.
 
double s_hor = 0.
 
double s_ver1 = 0.
 
double s_ver2 = 0.
 
double spmu [121][62][51]
 
double fnmu [32401]
 
double depth [360][91]
 
double fmu [360][91]
 
double the1
 
double the2
 
double ph1
 
double ph2
 
double se = 0.
 
double st = 0.
 
double sp = 0.
 
double sd = 0.
 
unsigned int NEvents = 0
 
TTree * fTree
 

Static Private Attributes

static const int kGAUS = 1
 

Detailed Description

module to produce single or multiple specified particles in the detector

Definition at line 191 of file MUSUN_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

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

Definition at line 332 of file MUSUN_module.cc.

References art::detail::EngineCreator::createEngine(), fCavernAngle, fChargeRatio, fDetRotX, fDetRotY, fDetRotZ, fEmax, fEmin, fEngine, figflag, fInputDir, fInputFile1, fInputFile2, fInputFile3, fPDG, fPhimax, fPhimin, fRockDensity, fSigmaT, fT0, fTDist, fThetamax, fThetamin, fXmax, fXmin, fYmax, fYmin, fZmax, and fZmin.

333  : art::EDProducer{pset}
334  // create a default random engine; obtain the random seed from NuRandomService,
335  // unless overridden in configuration with key "Seed"
336  , fEngine(art::ServiceHandle<rndm::NuRandomService>()->registerAndSeedEngine(createEngine(0),
337  pset,
338  "Seed"))
339  , fPDG{pset.get<int>("PDG")}
340  , fChargeRatio{pset.get<double>("ChargeRatio")}
341  , fInputDir{pset.get<std::string>("InputDir")}
342  , fInputFile1{pset.get<std::string>("InputFile1")}
343  , fInputFile2{pset.get<std::string>("InputFile2")}
344  , fInputFile3{pset.get<std::string>("InputFile3")}
345  , fCavernAngle{pset.get<double>("CavernAngle")}
346  , fRockDensity{pset.get<double>("RockDensity")}
347  , fEmin{pset.get<double>("Emin")}
348  , fEmax{pset.get<double>("Emax")}
349  , fThetamin{pset.get<double>("Thetamin")}
350  , fThetamax{pset.get<double>("Thetamax")}
351  , fPhimin{pset.get<double>("Phimin")}
352  , fPhimax{pset.get<double>("Phimax")}
353  , figflag{pset.get<int>("igflag")}
354  , fXmin{pset.get<double>("Xmin")}
355  , fYmin{pset.get<double>("Ymin")}
356  , fZmin{pset.get<double>("Zmin")}
357  , fXmax{pset.get<double>("Xmax")}
358  , fYmax{pset.get<double>("Ymax")}
359  , fZmax{pset.get<double>("Zmax")}
360  , fDetRotX{pset.get<double>("DetRotX")}
361  , fDetRotY{pset.get<double>("DetRotY")}
362  , fDetRotZ{pset.get<double>("DetRotZ")}
363  , fT0{pset.get<double>("T0")}
364  , fSigmaT{pset.get<double>("SigmaT")}
365  , fTDist{pset.get<int>("TDist")}
366  {
367  produces<std::vector<simb::MCTruth>>();
368  produces<sumdata::RunData, art::InRun>();
369  }
base_engine_t & createEngine(seed_t seed)
double fEmax
Maximum Kinetic Energy (GeV)
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
double fDetRotZ
How much the detector should be rotated around Z axis (rotates the coordinate system clockwise)) ...
double fCavernAngle
Angle of the detector from the North to the East.
double fEmin
Minimum Kinetic Energy (GeV)
double fThetamin
Minimum theta.
std::string fInputDir
Input Directory.
double fDetRotY
How much the detector should be rotated around Y axis (rotates the coordinate system clockwise)) ...
double fT0
Central t position (ns) in world coordinates.
double fDetRotX
How much the detector should be rotated around X axis (rotates the coordinate system clockwise)) ...
int fTDist
How to distribute t (gaus, or uniform)
double fRockDensity
int fPDG
PDG code of particles to generate.
double fPhimax
Maximum phi.
std::string fInputFile3
Input File 3.
double fPhimin
Minimum phi.
double fChargeRatio
Charge ratio of particle / anti-particle.
std::string fInputFile2
Input File 2.
int figflag
If want sampled from sphere or parallelepiped.
double fYmin
Minimum Y position.
double fZmin
Minimum Z position.
double fSigmaT
Variation in t position (ns)
CLHEP::HepRandomEngine & fEngine
art-managed random-number engine
double fThetamax
Maximum theta.
double fXmin
Minimum X position.
std::string fInputFile1
Input File 1.
double fXmax
Maximum X position.

Member Function Documentation

void evgen::MUSUN::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 374 of file MUSUN_module.cc.

References cx, cy, cz, dep, Energy, fDetRotX, fDetRotY, fDetRotZ, fTree, MF_LOG_WARNING, PdgCode, phi, theta, Time, x0, y0, and z0.

375  {
376 
377  fDetRotX = fDetRotX * M_PI / 180.;
378  fDetRotY = fDetRotY * M_PI / 180.;
379  fDetRotZ = fDetRotZ * M_PI / 180.;
380 
381  MF_LOG_WARNING("MUSUN") << "Rotation: X = " << fDetRotX << ", Y = " << fDetRotY
382  << ", Z = " << fDetRotZ << std::endl;
383 
384  // Make the Histograms....
386  /*
387  hPDGCode = tfs->make<TH1D>("hPDGCode" ,"PDG Code" ,30 , -15 , 15 );
388  hPositionX = tfs->make<TH1D>("hPositionX" ,"Position (cm)" ,500, ( fXmin - 10 ), ( fXmax + 10 ) );
389  hPositionY = tfs->make<TH1D>("hPositionY" ,"Position (cm)" ,500, ( fYmin - 10 ), ( fYmax + 10 ) );
390  hPositionZ = tfs->make<TH1D>("hPositionZ" ,"Position (cm)" ,500, ( fZmin - 10 ), ( fZmax + 10 ) );
391  hTime = tfs->make<TH1D>("hTime" ,"Time (s)" ,500, 0 , 1e6 );
392  hMomentumHigh = tfs->make<TH1D>("hMomentumHigh","Momentum (GeV)",500, fEmin, fEmax );
393  hMomentum = tfs->make<TH1D>("hMomentum" ,"Momentum (GeV)",500, fEmin, fEmin+1e3 );
394  hEnergyHigh = tfs->make<TH1D>("hEnergyHigh" ,"Energy (GeV)" ,500, fEmin, fEmax );
395  hEnergy = tfs->make<TH1D>("hEnergy" ,"Energy (GeV)" ,500, fEmin, fEmin+1e3 );
396  hDepth = tfs->make<TH1D>("hDepth" ,"Depth (m)" ,800, 0 , 14000 );
397 
398  hDirCosineX = tfs->make<TH1D>("hDirCosineX","Normalised Direction cosine",500, -1, 1 );
399  hDirCosineY = tfs->make<TH1D>("hDirCosineY","Normalised Direction cosine",500, -1, 1 );
400  hDirCosineZ = tfs->make<TH1D>("hDirCosineZ","Normalised Direction cosine",500, -1, 1 );
401 
402  hTheta = tfs->make<TH1D>("hTheta" ,"Angle (degrees)",500, 0, 90 );
403  hPhi = tfs->make<TH1D>("hPhi" ,"Angle (degrees)",500, 0, 365 );
404  */
405  fTree = tfs->make<TTree>("Generator", "analysis tree");
406  fTree->Branch("particleID", &PdgCode, "particleID/I");
407  fTree->Branch("energy", &Energy, "energy/D");
408  fTree->Branch("time", &Time, "Time/D");
409  fTree->Branch("posX", &x0, "posX/D");
410  fTree->Branch("posY", &y0, "posY/D");
411  fTree->Branch("posZ", &z0, "posZ/D");
412  fTree->Branch("cosX", &cx, "cosX/D");
413  fTree->Branch("cosY", &cy, "cosY/D");
414  fTree->Branch("cosZ", &cz, "cosZ/D");
415  fTree->Branch("theta", &theta, "theta/D");
416  fTree->Branch("phi", &phi, "phi/D");
417  fTree->Branch("depth", &dep, "dep/D");
418  /*
419  fCryos = tfs->make<TTree>("CryoSizes","cryo tree");
420  fCryos->Branch("NumTPCs" , &NumTPCs , "NumTPCs/I" );
421  fCryos->Branch("TPCMinX" , &TPCMinX , "TPCMinX[NumTPCs]/D");
422  fCryos->Branch("TPCMaxX" , &TPCMaxX , "TPCMaxX[NumTPCs]/D");
423  fCryos->Branch("TPCMinY" , &TPCMinY , "TPCMinY[NumTPCs]/D");
424  fCryos->Branch("TPCMaxY" , &TPCMaxY , "TPCMaxY[NumTPCs]/D");
425  fCryos->Branch("TPCMinZ" , &TPCMinZ , "TPCMinZ[NumTPCs]/D");
426  fCryos->Branch("TPCMaxZ" , &TPCMaxZ , "TPCMaxZ[NumTPCs]/D");
427  fCryos->Branch("CryoSize", &CryoSize, "CryoSize[6]/D" );
428  fCryos->Branch("DetHall" , &DetHall , "DetHall[6]/D" );
429  */
430  }
double fDetRotZ
How much the detector should be rotated around Z axis (rotates the coordinate system clockwise)) ...
double fDetRotY
How much the detector should be rotated around Y axis (rotates the coordinate system clockwise)) ...
double fDetRotX
How much the detector should be rotated around X axis (rotates the coordinate system clockwise)) ...
#define MF_LOG_WARNING(category)
void evgen::MUSUN::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 435 of file MUSUN_module.cc.

References geo::GeometryCore::DetectorName(), fEmax, fEmin, FI, figflag, fPhimax, fPhimin, fRockDensity, fThetamax, fThetamin, art::fullRun(), fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, initialization(), art::Run::put(), s_hor, s_ver1, and s_ver2.

436  {
437  // Check fcl parameters were set correctly
438  if (fThetamax > 90.5)
439  throw cet::exception("MUSUNGen")
440  << "\nThetamax has to be less than " << M_PI / 2 << ", but was entered as " << fThetamax
441  << ", this causes an error so leaving program now...\n\n";
442  if (fThetamin < 0)
443  throw cet::exception("MUSUNGen")
444  << "\nThetamin has to be more than 0, but was entered as " << fThetamin
445  << ", this causes an error so leaving program now...\n\n";
446  if (fThetamax < fThetamin)
447  throw cet::exception("MUSUNGen") << "\nMinimum angle is bigger than maximum angle....causes "
448  "an error so leaving program now....\n\n";
449  if (fPhimax > 360.5)
450  throw cet::exception("MUSUNGen")
451  << "\nPhimax has to be less than " << 2 * M_PI << ", but was entered as " << fPhimax
452  << ", this cause an error so leaving program now...\n\n";
453  if (fPhimin < 0)
454  throw cet::exception("MUSUNGen")
455  << "\nPhimin has to be more than 0, but was entered as " << fPhimin
456  << ", this causes an error so leaving program now...\n\n";
457  if (fPhimax < fPhimin)
458  throw cet::exception("MUSUNGen") << "\nMinimum angle is bigger than maximum angle....causes "
459  "an error so leaving program now....\n\n";
460  if (fEmax < fEmin)
461  throw cet::exception("MUSUNGen")
462  << "\nMinimum energy is bigger than maximum energy....causes an error so leaving program "
463  "now....\n\n";
464 
465  // grab the geometry object to see what geometry we are using
467  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()), art::fullRun());
468 
469  // area of the horizontal plane of the parallelepiped
470  s_hor = (fZmax - fZmin) * (fXmax - fXmin);
471  // area of the vertical plane of the parallelepiped, perpendicular to z-axis
472  s_ver1 = (fXmax - fXmin) * (fYmax - fYmin);
473  // area of the vertical plane of the parallelepiped, perpendicular to x-axis
474  s_ver2 = (fZmax - fZmin) * (fYmax - fYmin);
475 
476  //std::cout << s_hor << " " << s_ver1 << " " << s_ver2 << std::endl;
477 
479 
480  std::cout << "Material - SURF rock" << std::endl;
481  std::cout << "Density = " << fRockDensity << " g/cm^3" << std::endl;
482  std::cout << "Parameters for muon spectrum are from LVD best fit" << std::endl;
483  std::cout << "Muon energy range = " << fEmin << " - " << fEmax << " GeV" << std::endl;
484  std::cout << "Zenith angle range = " << fThetamin << " - " << fThetamax << " degrees"
485  << std::endl;
486  std::cout << "Azimuthal angle range = " << fPhimin << " - " << fPhimax << " degrees"
487  << std::endl;
488  std::cout << "Global intensity = " << FI
489  << " (cm^2 s)^(-1) or s^(-1) (for muons on the surface)" << std::endl;
490  /*
491  NumTPCs = geo->NTPC(0);
492  std::cout << "There are " << NumTPCs << " in cryostat 0" << std::endl;
493  for (unsigned int c=0; c<geo->Ncryostats(); c++) {
494  const geo::CryostatGeo& cryostat=geo->Cryostat(c);
495  geo->CryostatBoundaries( CryoSize, 0 );
496  std::cout << "Cryo bounds " << CryoSize[0] << " "<< CryoSize[1] << " "<< CryoSize[2] << " "<< CryoSize[3] << " "<< CryoSize[4] << " "<< CryoSize[5] << std::endl;
497  for (unsigned int t=0; t<cryostat.NTPC(); t++) {
498  geo::TPCID id;
499  id.Cryostat=c;
500  id.TPC=t;
501  id.isValid=true;
502  const geo::TPCGeo& tpc=cryostat.TPC(id);
503  TPCMinX[t] = tpc.MinX();
504  TPCMaxX[t] = tpc.MaxX();
505  TPCMinY[t] = tpc.MinY();
506  TPCMaxY[t] = tpc.MaxY();
507  TPCMinZ[t] = tpc.MinZ();
508  TPCMaxZ[t] = tpc.MaxZ();
509  std::cout << t << "\t" << TPCMinX[t] << " " << TPCMaxX[t] << " " << TPCMinY[t] << " " << TPCMaxY[t] << " " << TPCMinZ[t] << " " << TPCMaxZ[t] << std::endl;
510  }
511  }
512  fCryos -> Fill();
513  */
514  return;
515  }
double fEmax
Maximum Kinetic Energy (GeV)
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
constexpr auto fullRun()
double fEmin
Minimum Kinetic Energy (GeV)
double fThetamin
Minimum theta.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Run.h:121
double fRockDensity
double fPhimax
Maximum phi.
double fPhimin
Minimum phi.
int figflag
If want sampled from sphere or parallelepiped.
void initialization(double theta1, double theta2, double phi1, double phi2, int figflag, double s_hor, double s_ver1, double s_ver2, double &FI)
double fYmin
Minimum Y position.
double fZmin
Minimum Z position.
double fThetamax
Maximum theta.
double fXmin
Minimum X position.
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:203
Namespace collecting geometry-related classes utilities.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double fXmax
Maximum X position.
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::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 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void evgen::MUSUN::endRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 520 of file MUSUN_module.cc.

References NEvents, sd, se, sp, and st.

521  {
522  std::cout << "\n\nNumber of muons = " << NEvents << std::endl;
523  std::cout << "Mean muon energy = " << se / NEvents << " GeV" << std::endl;
524  std::cout << "Mean zenith angle (theta) = " << st / NEvents << " degrees" << std::endl;
525  std::cout << "Mean azimuthal angle (phi)= " << sp / NEvents << " degrees" << std::endl;
526  std::cout << "Mean slant depth = " << sd / NEvents << " m w.e." << std::endl;
527  }
unsigned int NEvents
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
void evgen::MUSUN::initialization ( double  theta1,
double  theta2,
double  phi1,
double  phi2,
int  figflag,
double  s_hor,
double  s_ver1,
double  s_ver2,
double &  FI 
)
private

Definition at line 708 of file MUSUN_module.cc.

References depth, e, fCavernAngle, fInputDir, fInputFile1, fInputFile2, fInputFile3, fmu, fnmu, in, ph1, ph2, phi, sc, spmu, the1, the2, and theta.

Referenced by beginRun().

717  {
718  //
719  // Read in the data files
720  //
721  int lineNumber = 0, index = 0;
722  char inputLine[10000];
723  std::string fROOTfile;
724 
725  for (int a = 0; a < 121; ++a)
726  for (int b = 0; b < 62; ++b)
727  for (int c = 0; c < 50; ++c)
728  spmu[a][b][c] = 0;
729  for (int a = 0; a < 23401; ++a)
730  fnmu[a] = 0;
731  for (int a = 0; a < 360; ++a)
732  for (int b = 0; b < 91; ++b)
733  depth[a][b] = 0;
734  for (int a = 0; a < 360; ++a)
735  for (int b = 0; b < 91; ++b)
736  fmu[a][b] = 0;
737 
738  std::ostringstream File1LocStream;
739  File1LocStream << fInputDir << fInputFile1;
740  std::string File1Loc = File1LocStream.str();
741  cet::search_path sp1("FW_SEARCH_PATH");
742  if (sp1.find_file(fInputFile1, fROOTfile)) File1Loc = fROOTfile;
743  std::ifstream file1(File1Loc.c_str(), std::ios::in);
744  if (!file1.good())
745  throw cet::exception("MUSUNGen")
746  << "\nFile1 " << fInputFile1 << " not found in FW_SEARCH_PATH or at " << fInputDir
747  << "\n\n";
748 
749  while (file1.good()) {
750  //std::cout << "Looking at file 1...." << std::endl;
751  file1.getline(inputLine, 9999);
752  char* token;
753  token = strtok(inputLine, " ");
754  while (token != NULL) {
755  //std::cout << "While loop file 1..." << std::endl;
756  fmu[index][lineNumber] = atof(token);
757  token = strtok(NULL, " ");
758  index++;
759  if (index == 360) {
760  //std::cout << "If statement file 1..." << std::endl;
761  index = 0;
762  lineNumber++;
763  }
764  }
765  }
766  file1.close();
767 
768  std::ostringstream File2LocStream;
769  File2LocStream << fInputDir << fInputFile2;
770  std::string File2Loc = File2LocStream.str();
771  cet::search_path sp2("FW_SEARCH_PATH");
772  if (sp2.find_file(fInputFile2, fROOTfile)) File2Loc = fROOTfile;
773  std::ifstream file2(File2Loc.c_str(), std::ios::binary | std::ios::in);
774  if (!file2.good())
775  throw cet::exception("MUSUNGen")
776  << "\nFile2 " << fInputFile2 << " not found in FW_SEARCH_PATH or at " << fInputDir
777  << "\n\n";
778 
779  int i1 = 0, i2 = 0, i3 = 0;
780  float readVal;
781  while (file2.good()) {
782  //std::cout << "Looking at file 2...." << std::endl;
783  file2.read((char*)(&readVal), sizeof(float));
784  spmu[i1][i2][i3] = readVal;
785  i1++;
786  if (i1 == 121) {
787  //std::cout << "First if statement file 2..." << std::endl;
788  i2++;
789  i1 = 0;
790  }
791  if (i2 == 62) {
792  //std::cout << "Second if statement file 2..." << std::endl;
793  i3++;
794  i2 = 0;
795  }
796  }
797  file2.close();
798  for (int i = 0; i < 120; i++)
799  for (int j = 0; j < 62; j++)
800  for (int k = 0; k < 51; k++)
801  spmu[i][j][k] = spmu[i + 1][j][k];
802  spmu[1][1][0] = 0.000853544;
803  //std::cout << "Set spmu to some value..." << std::endl;
804 
805  std::ostringstream File3LocStream;
806  File3LocStream << fInputDir << fInputFile3;
807  std::string File3Loc = File3LocStream.str();
808  cet::search_path sp3("FW_SEARCH_PATH");
809  if (sp3.find_file(fInputFile3, fROOTfile)) File3Loc = fROOTfile;
810  std::ifstream file3(File3Loc.c_str(), std::ios::in);
811  if (!file3.good())
812  throw cet::exception("MUSUNGen")
813  << "\nFile3 " << fInputFile3 << " not found in FW_SEARCH_PATH or at " << fInputDir
814  << "\n\n";
815 
816  lineNumber = index = 0;
817  while (file3.good()) {
818  //std::cout << "Looking at file 3...." << std::endl;
819  file3.getline(inputLine, 9999);
820  char* token;
821  token = strtok(inputLine, " ");
822  while (token != NULL) {
823  //std::cout << "While loop file 3..." << std::endl;
824  depth[index][lineNumber] = atof(token);
825  token = strtok(NULL, " ");
826  index++;
827  if (index == 360) {
828  //std::cout << "If statement file 3..." << std::endl;
829  index = 0;
830  lineNumber++;
831  }
832  }
833  }
834  file3.close();
835 
836  //
837  // Set up variables
838  //
839 
840  the1 = theta1;
841  the2 = theta2;
842  // for c2: c1 and c2 are unused
843  //double c1 = cos(M_PI/180.*theta1);
844  //double c2 = cos(M_PI/180.*theta2);
845  ph1 = M_PI / 180. * phi1;
846  ph2 = M_PI / 180. * phi2;
847  // for c2: dph is unused
848  //double dph = ph2-ph1;
849 
850  int ipc = 1;
851  double theta = theta1;
852  double dc = 1.;
853  double sc = 0.;
854  int iteration = 0;
855  while (theta < theta2 - dc / 2.) {
856  theta += dc / 2.;
857  double theta0 = M_PI / 180. * theta;
858  double cc = cos(theta0);
859  double ash = s_hor * cc;
860  double asv01 = s_ver1 * sqrt(1. - cc * cc);
861  double asv02 = s_ver2 * sqrt(1. - cc * cc);
862  int ic1 = (theta + 0.999);
863  int ic2 = ic1 + 1;
864  if (ic2 > 91) ic2 = 91;
865  if (ic1 < 1) ic1 = 1;
866  double phi = phi1;
867  double dp = 1.;
868 
869  while (phi < phi2 - dp / 2.) {
870  phi += dp / 2.;
871  // the long side of the cavern is pointing at 14 deg to the north:
872  // double phi0 = M_PI / 180. * (phi + 90. - 14);
873 
874  // Want our co-ord system going from East to South.
875  double phi0 = M_PI / 180. * (phi + fCavernAngle);
876 
877  double asv1 = asv01 * fabs(cos(phi0));
878  double asv2 = asv02 * fabs(sin(phi0));
879  double asv0 = ash + asv1 + asv2;
880  double fl = 1.;
881  if (figflag == 1) fl = asv0;
882  int ip1 = (phi + 0.999);
883  int ip2 = ip1 + 1;
884  if (ip2 > 360) ip2 = 1;
885  if (ip1 < 1) ip1 = 360;
886  double sp1 = 0.;
887 
888  for (int ii = 0; ii < 4; ii++) {
889  int iic = ii / 2;
890  int iip = ii % 2;
891  if (ip1 == 360 && (ii == 1 || ii == 3)) iip = -359;
892  if (fmu[ip1 + iip - 1][ic1 + iic - 1] < 0) {
893  if (pow(10., fmu[ip1 + iip - 1][ic1 + iic - 1]) / 4 > 1e-6) {
894  std::cout << "Looking at fmu [ " << ip1 << " + " << iip << " - 1 (" << ip1 + iip - 1
895  << ") ] [ " << ic1 << " + " << iic << " - 1 (" << ic1 + iic - 1 << ") ] ."
896  << "\nChanging sp1 from " << sp1 << " to "
897  << sp1 + pow(10., fmu[ip1 + iip - 1][ic1 + iic - 1]) / 4 << "..........."
898  << sp1 << " + 10 ^ (" << fmu[ip1 + iip - 1][ic1 + iic - 1] << ") / 4 "
899  << std::endl;
900  }
901  sp1 = sp1 + pow(10., fmu[ip1 + iip - 1][ic1 + iic - 1]) / 4;
902  }
903  }
904  /*
905  std::cout << iteration<< " time of new sc value! Theta " << theta << ", phi " << phi + dp / 2. << ", sc = " << sc + sp1 * fl * dp * M_PI / 180. * sin(theta0) * dc * M_PI / 180. << " = "
906  << sc << " + " << sp1 << " * " << fl << " * " << dp << " * " << M_PI/180 << " * sin(" << theta0 << ") * " << dc << " * " << M_PI/180 << ".....sin(theta)=" << sin(theta) << "\n"
907  << std::endl; */
908  sc = sc + sp1 * fl * dp * M_PI / 180. * sin(theta0) * dc * M_PI / 180.;
909  ++iteration;
910  ipc = ipc + 1;
911  fnmu[ipc - 1] = sc;
912  phi = phi + dp / 2.;
913  }
914 
915  theta = theta + dc / 2.;
916  }
917  //std::cout << *FI << " = " << sc << std::endl;
918  FI = sc;
919  for (int ipc1 = 0; ipc1 < ipc; ipc1++)
920  fnmu[ipc1] = fnmu[ipc1] / fnmu[ipc - 1];
921  }
double fCavernAngle
Angle of the detector from the North to the East.
std::string fInputDir
Input Directory.
double fmu[360][91]
std::string fInputFile3
Input File 3.
std::string fInputFile2
Input File 2.
double depth[360][91]
int figflag
If want sampled from sphere or parallelepiped.
double spmu[121][62][51]
ifstream in
Definition: comparison.C:7
Float_t sc
Definition: plot.C:23
double fnmu[32401]
Float_t e
Definition: plot.C:35
std::string fInputFile1
Input File 1.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void evgen::MUSUN::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 531 of file MUSUN_module.cc.

References fEngine, simb::kSingleParticle, MF_LOG_DEBUG, NEvents, art::Event::put(), SampleOne(), and simb::MCTruth::SetOrigin().

532  {
534  std::unique_ptr<std::vector<simb::MCTruth>> truthcol(new std::vector<simb::MCTruth>);
535 
536  simb::MCTruth truth;
538 
539  ++NEvents;
540 
541  SampleOne(NEvents, truth, fEngine);
542 
543  MF_LOG_DEBUG("MUSUN") << truth;
544 
545  truthcol->push_back(truth);
546 
547  evt.put(std::move(truthcol));
548  }
unsigned int NEvents
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:82
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
single particles thrown at the detector
Definition: MCTruth.h:26
void SampleOne(unsigned int i, simb::MCTruth &mct, CLHEP::HepRandomEngine &engine)
#define MF_LOG_DEBUG(id)
CLHEP::HepRandomEngine & fEngine
art-managed random-number engine
Event generator information.
Definition: MCTruth.h:32
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void evgen::MUSUN::SampleOne ( unsigned int  i,
simb::MCTruth mct,
CLHEP::HepRandomEngine &  engine 
)
private

Definition at line 554 of file MUSUN_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), cx, cy, cz, dep, Energy, fCavernAngle, fChargeRatio, fDetRotX, fDetRotY, fDetRotZ, fPDG, fSigmaT, fT0, fTDist, fTree, fXmax, fXmin, fYmax, fYmin, fZmax, fZmin, kGAUS, Momentum, part, PdgCode, phi, px0, py0, pz0, s_hor, s_ver1, s_ver2, sampling(), sd, se, sp, st, theta, Time, x0, y0, and z0.

Referenced by produce().

555  {
556  CLHEP::RandFlat flat(engine);
557  CLHEP::RandGaussQ gauss(engine);
558 
559  Energy = 0;
560  theta = 0;
561  phi = 0;
562  dep = 0;
563  Time = 0;
564 
565  sampling(Energy, theta, phi, dep, engine);
566 
567  theta = theta * M_PI / 180;
568 
569  // changing the angle phi so z-axis is positioned along the long side
570  // of the cavern pointing at 14 deg from the North to the East.
571  // phi += (90. - 14.0);
572  // Want our co-ord rotation going from East to South.
573  phi += fCavernAngle;
574  if (phi >= 360.) phi -= 360.;
575  if (phi < 0) phi += 360.;
576  phi *= M_PI / 180.;
577 
578  // set track id to -i as these are all primary particles and have id <= 0
579  int trackid = -1 * (i + 1);
580  std::string primary("primary");
581 
582  // Work out whether particle/antiparticle, and mass...
583  double m = 0.0;
584  PdgCode = fPDG;
585  double ChargeCheck = 1. / (1 + fChargeRatio);
586  double pdgfire = flat.fire();
587  if (pdgfire < ChargeCheck) PdgCode = -PdgCode;
588 
589  static TDatabasePDG pdgt;
590  TParticlePDG* pdgp = pdgt.GetParticle(PdgCode);
591  if (pdgp) m = pdgp->Mass();
592 
593  //std::cout << pdgfire << " " << ChargeCheck << " " << PdgCode << " " << m << std::endl;
594 
595  // Work out T0...
596  if (fTDist == kGAUS) { Time = gauss.fire(fT0, fSigmaT); }
597  else {
598  Time = fT0 + fSigmaT * (2.0 * flat.fire() - 1.0);
599  }
600 
601  // The minus sign above is for y-axis pointing up, so the y-momentum
602  // is always pointing down
603  cx = +sin(theta) * sin(phi);
604  cy = -cos(theta);
605  cz = +sin(theta) * cos(phi);
606  Momentum = std::sqrt(Energy * Energy - m * m); // Get momentum
607  px0 = Momentum * cx;
608  py0 = Momentum * cy;
609  pz0 = Momentum * cz;
610  TLorentzVector pvec(px0, py0, pz0, Energy);
611 
612  // transform into actual detector's coordinates
613  pvec.RotateX(-fDetRotX);
614  pvec.RotateY(-fDetRotY);
615  pvec.RotateZ(-fDetRotZ);
616 
617  // Muon coordinates
618  double sh1 = s_hor * cos(theta);
619  double sv1 = s_ver1 * sin(theta) * fabs(cos(phi));
620  double sv2 = s_ver2 * sin(theta) * fabs(sin(phi));
621  double ss = sh1 + sv1 + sv2;
622  double xfl1 = flat.fire();
623  if (xfl1 <= sh1 / ss) {
624  x0 = (fXmax - fXmin) * flat.fire() + fXmin;
625  y0 = fYmax;
626  z0 = (fZmax - fZmin) * flat.fire() + fZmin;
627  }
628  else if (xfl1 <= (sh1 + sv1) / ss) {
629  x0 = (fXmax - fXmin) * flat.fire() + fXmin;
630  y0 = (fYmax - fYmin) * flat.fire() + fYmin;
631  if (cz >= 0)
632  z0 = fZmin;
633  else
634  z0 = fZmax;
635  }
636  else {
637  if (cx >= 0)
638  x0 = fXmin;
639  else
640  x0 = fXmax;
641  y0 = (fYmax - fYmin) * flat.fire() + fYmin;
642  z0 = (fZmax - fZmin) * flat.fire() + fZmin;
643  }
644  // Make Lorentz vector for x and t....
645  TLorentzVector pos(x0, y0, z0, Time);
646 
647  // transform into actual detector's coordinates
648  pos.RotateX(-fDetRotX);
649  pos.RotateY(-fDetRotY);
650  pos.RotateZ(-fDetRotZ);
651 
652  // Parameters written to the file muons_surf_v2_test*.dat
653  // nmu - muon sequential number
654  // id_part - muon charge (10 - positive, 11 - negative )
655  // Energy - total muon energy in GeV assuming ultrarelativistic muons
656  // x0, y0, z0 - muon coordinates on the surface of parallelepiped
657  // specified above; x-axis and y-axis are pointing in the
658  // directions such that the angle phi (from the slant depth
659  // distribution files) is measured from x to y. z-axis is
660  // pointing upwards.
661  // cx, cy, cz - direction cosines.
662 
663  simb::MCParticle part(trackid, PdgCode, primary);
664  part.AddTrajectoryPoint(pos, pvec);
665 
666  mct.Add(part);
667 
668  theta = theta * 180 / M_PI;
669  phi = phi * 180 / M_PI;
670 
671  // Sum energies, angles, depth for average outputs.
672  se += Energy;
673  st += theta;
674  sp += phi;
675  sd += dep;
676 
677  // Fill Histograms.....
678  /*
679  hPDGCode ->Fill (PdgCode);
680  hPositionX ->Fill (x0);
681  hPositionY ->Fill (y0);
682  hPositionZ ->Fill (z0);
683  hTime ->Fill (Time);
684  hMomentumHigh ->Fill (Momentum);
685  hMomentum ->Fill (Momentum);
686  hEnergyHigh ->Fill (Energy);
687  hEnergy ->Fill (Energy);
688  hDepth ->Fill (dep);
689  hDirCosineX ->Fill (cx);
690  hDirCosineY ->Fill (cy);
691  hDirCosineZ ->Fill (cz);
692  hTheta ->Fill (theta);
693  hPhi ->Fill (phi);
694  */
695  /*
696  // Write event by event outsputs.....
697  std::cout << "Theta: " << theta << " Phi: " << phi << " Energy: " << Energy << " Momentum: " << Momentum << std::endl;
698  std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
699  std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
700  std::cout << "Normalised..." << cx << " " << cy << " " << cz << std::endl;
701  */
702  fTree->Fill();
703  }
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
double fDetRotZ
How much the detector should be rotated around Z axis (rotates the coordinate system clockwise)) ...
double fCavernAngle
Angle of the detector from the North to the East.
static const int kGAUS
double fDetRotY
How much the detector should be rotated around Y axis (rotates the coordinate system clockwise)) ...
double fT0
Central t position (ns) in world coordinates.
double fDetRotX
How much the detector should be rotated around X axis (rotates the coordinate system clockwise)) ...
int fTDist
How to distribute t (gaus, or uniform)
TString part[npart]
Definition: Style.C:32
int fPDG
PDG code of particles to generate.
double fChargeRatio
Charge ratio of particle / anti-particle.
double fYmin
Minimum Y position.
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
double fZmin
Minimum Z position.
double fSigmaT
Variation in t position (ns)
double fXmin
Minimum X position.
void sampling(double &E, double &theta, double &phi, double &dep, CLHEP::HepRandomEngine &engine)
double fXmax
Maximum X position.
void evgen::MUSUN::sampling ( double &  E,
double &  theta,
double &  phi,
double &  dep,
CLHEP::HepRandomEngine &  engine 
)
private

Definition at line 926 of file MUSUN_module.cc.

References DEFINE_ART_MODULE, depth, fnmu, fRockDensity, ph1, spmu, and the1.

Referenced by SampleOne().

931  {
932  CLHEP::RandFlat flat(engine);
933  CLHEP::RandGaussQ gauss(engine);
934 
935 #if 0 // this code is disabled for good
936  double xfl = flat.fire();
937  int loIndex = 0, hiIndex = 32400;
938  int i = (loIndex+hiIndex)/2;
939  bool foundIndex = false;
940  if( xfl < fnmu[loIndex] ) {
941  i = loIndex;
942  foundIndex = true;
943  } else if ( xfl > fnmu[hiIndex] ) {
944  i = hiIndex;
945  foundIndex = true;
946  } else if ( xfl > fnmu[i-1] && xfl <= fnmu[i] )
947  foundIndex = true;
948  while( !foundIndex ) {
949  if( xfl < fnmu[i] )
950  hiIndex = i;
951  else
952  loIndex = i;
953  i = (loIndex + hiIndex)/2;
954 
955  if( xfl > fnmu[i-1] && xfl <= fnmu[i] )
956  foundIndex = true;
957  }
958 #else
959  double xfl = flat.fire();
960  int i = 0;
961  while (xfl > fnmu[i])
962  ++i;
963 #endif
964  int ic = (i - 2) / 360;
965  int ip = i - 2 - ic * 360;
966 
967  xfl = flat.fire();
968  theta = the1 + ((double)ic + xfl);
969  xfl = flat.fire();
970  phi = ph1 + ((double)ip + xfl);
971  if (phi > 360) phi = phi - 360;
972  dep = depth[ip][ic] * fRockDensity;
973 
974  int ic1 = cos(M_PI / 180. * theta) * 50.;
975  if (ic1 < 0) ic1 = 0;
976  if (ic1 > 50) ic1 = 50;
977  int ip1 = dep / 200. - 16;
978  if (ip1 < 0) ip1 = 0;
979  if (ip1 > 61) ip1 = 61;
980 
981  xfl = flat.fire();
982 #if 0
983  loIndex = 0, hiIndex = 120;
984  int j = (loIndex+hiIndex)/2;
985  foundIndex = false;
986  if( xfl < spmu[loIndex][ip1][ic1] ) {
987  j = loIndex;
988  foundIndex = true;
989  } else if ( xfl > spmu[hiIndex][ip1][ic1] ) {
990  j = hiIndex;
991  foundIndex = true;
992  } else if ( xfl > spmu[j-1][ip1][ic1] && xfl <= spmu[j][ip1][ic1] )
993  foundIndex = true;
994  while( !foundIndex ) {
995  if( xfl < spmu[j][ip1][ic1] )
996  hiIndex = j;
997  else
998  loIndex = j;
999  j = (loIndex + hiIndex)/2;
1000 
1001  if( xfl > spmu[j-1][ip1][ic1] && xfl <= spmu[j][ip1][ic1] )
1002  foundIndex = true;
1003  }
1004 #else
1005  int j = 0;
1006  while (xfl > spmu[j][ip1][ic1])
1007  ++j;
1008 #endif
1009 
1010  double En1 = 0.05 * (j - 1);
1011  double En2 = 0.05 * (j);
1012  E = pow(10., En1 + (En2 - En1) * flat.fire());
1013 
1014  return;
1015  }
double fRockDensity
Float_t E
Definition: plot.C:20
double depth[360][91]
double spmu[121][62][51]
double fnmu[32401]
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

double evgen::MUSUN::cx
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::cy
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::cz
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::dep
private

Definition at line 287 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::depth[360][91]
private

Definition at line 299 of file MUSUN_module.cc.

Referenced by initialization(), and sampling().

double evgen::MUSUN::Energy
private

Definition at line 287 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::fCavernAngle
private

Angle of the detector from the North to the East.

Definition at line 233 of file MUSUN_module.cc.

Referenced by initialization(), MUSUN(), and SampleOne().

double evgen::MUSUN::fChargeRatio
private

Charge ratio of particle / anti-particle.

Definition at line 226 of file MUSUN_module.cc.

Referenced by MUSUN(), and SampleOne().

double evgen::MUSUN::fDetRotX
private

How much the detector should be rotated around X axis (rotates the coordinate system clockwise))

Rotation of the detector w.r.t. DUNE HD FD nominal coordinate system - Z: beam direction; Y: vertical; X: drift; right-handed Rotation performed in the order - first around X, then around new Y, and then around new Z

Definition at line 258 of file MUSUN_module.cc.

Referenced by beginJob(), MUSUN(), and SampleOne().

double evgen::MUSUN::fDetRotY
private

How much the detector should be rotated around Y axis (rotates the coordinate system clockwise))

Definition at line 260 of file MUSUN_module.cc.

Referenced by beginJob(), MUSUN(), and SampleOne().

double evgen::MUSUN::fDetRotZ
private

How much the detector should be rotated around Z axis (rotates the coordinate system clockwise))

Definition at line 262 of file MUSUN_module.cc.

Referenced by beginJob(), MUSUN(), and SampleOne().

double evgen::MUSUN::fEmax
private

Maximum Kinetic Energy (GeV)

Definition at line 240 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

double evgen::MUSUN::fEmin
private

Minimum Kinetic Energy (GeV)

Definition at line 239 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

CLHEP::HepRandomEngine& evgen::MUSUN::fEngine
private

art-managed random-number engine

Definition at line 223 of file MUSUN_module.cc.

Referenced by MUSUN(), and produce().

double evgen::MUSUN::FI = 0.
private

Definition at line 292 of file MUSUN_module.cc.

Referenced by beginRun().

int evgen::MUSUN::figflag
private

If want sampled from sphere or parallelepiped.

Definition at line 247 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

std::string evgen::MUSUN::fInputDir
private

Input Directory.

Definition at line 228 of file MUSUN_module.cc.

Referenced by initialization(), and MUSUN().

std::string evgen::MUSUN::fInputFile1
private

Input File 1.

Definition at line 229 of file MUSUN_module.cc.

Referenced by initialization(), and MUSUN().

std::string evgen::MUSUN::fInputFile2
private

Input File 2.

Definition at line 230 of file MUSUN_module.cc.

Referenced by initialization(), and MUSUN().

std::string evgen::MUSUN::fInputFile3
private

Input File 3.

Definition at line 231 of file MUSUN_module.cc.

Referenced by initialization(), and MUSUN().

double evgen::MUSUN::fmu[360][91]
private

Definition at line 300 of file MUSUN_module.cc.

Referenced by initialization().

double evgen::MUSUN::fnmu[32401]
private

Definition at line 298 of file MUSUN_module.cc.

Referenced by initialization(), and sampling().

int evgen::MUSUN::fPDG
private

PDG code of particles to generate.

Definition at line 225 of file MUSUN_module.cc.

Referenced by MUSUN(), and SampleOne().

double evgen::MUSUN::fPhimax
private

Maximum phi.

Definition at line 245 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

double evgen::MUSUN::fPhimin
private

Minimum phi.

Definition at line 244 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

double evgen::MUSUN::fRockDensity
private

Default rock density is 2.70 g cm-3. If this is changed then the three input files need to be remade. If there is a desire for this contact Vitaly Kudryavtsev at V.Kud.nosp@m.ryav.nosp@m.tsev@.nosp@m.shef.nosp@m..ac.u.nosp@m.k

Definition at line 234 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and sampling().

double evgen::MUSUN::fSigmaT
private

Variation in t position (ns)

Definition at line 265 of file MUSUN_module.cc.

Referenced by MUSUN(), and SampleOne().

double evgen::MUSUN::fT0
private

Central t position (ns) in world coordinates.

Definition at line 264 of file MUSUN_module.cc.

Referenced by MUSUN(), and SampleOne().

int evgen::MUSUN::fTDist
private

How to distribute t (gaus, or uniform)

Definition at line 266 of file MUSUN_module.cc.

Referenced by MUSUN(), and SampleOne().

double evgen::MUSUN::fThetamax
private

Maximum theta.

Definition at line 243 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

double evgen::MUSUN::fThetamin
private

Minimum theta.

Definition at line 242 of file MUSUN_module.cc.

Referenced by beginRun(), and MUSUN().

TTree* evgen::MUSUN::fTree
private

Definition at line 312 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::fXmax
private

Maximum X position.

Definition at line 251 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

double evgen::MUSUN::fXmin
private

Minimum X position.

Definition at line 248 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

double evgen::MUSUN::fYmax
private

Maximum Y position.

Definition at line 252 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

double evgen::MUSUN::fYmin
private

Minimum Y position.

Definition at line 249 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

double evgen::MUSUN::fZmax
private

Maximum Z position.

Definition at line 253 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

double evgen::MUSUN::fZmin
private

Minimum Z position.

Definition at line 250 of file MUSUN_module.cc.

Referenced by beginRun(), MUSUN(), and SampleOne().

const int evgen::MUSUN::kGAUS = 1
staticprivate

Definition at line 221 of file MUSUN_module.cc.

Referenced by SampleOne().

double evgen::MUSUN::Momentum
private

Definition at line 288 of file MUSUN_module.cc.

Referenced by SampleOne().

unsigned int evgen::MUSUN::NEvents = 0
private

Definition at line 309 of file MUSUN_module.cc.

Referenced by endRun(), and produce().

int evgen::MUSUN::PdgCode
private

Definition at line 286 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::ph1
private

Definition at line 303 of file MUSUN_module.cc.

Referenced by initialization(), and sampling().

double evgen::MUSUN::ph2
private

Definition at line 303 of file MUSUN_module.cc.

Referenced by initialization().

double evgen::MUSUN::phi
private

Definition at line 287 of file MUSUN_module.cc.

Referenced by beginJob(), initialization(), and SampleOne().

double evgen::MUSUN::px0
private

Definition at line 288 of file MUSUN_module.cc.

Referenced by SampleOne().

double evgen::MUSUN::py0
private

Definition at line 288 of file MUSUN_module.cc.

Referenced by SampleOne().

double evgen::MUSUN::pz0
private

Definition at line 288 of file MUSUN_module.cc.

Referenced by SampleOne().

double evgen::MUSUN::s_hor = 0.
private

Definition at line 293 of file MUSUN_module.cc.

Referenced by beginRun(), and SampleOne().

double evgen::MUSUN::s_ver1 = 0.
private

Definition at line 294 of file MUSUN_module.cc.

Referenced by beginRun(), and SampleOne().

double evgen::MUSUN::s_ver2 = 0.
private

Definition at line 295 of file MUSUN_module.cc.

Referenced by beginRun(), and SampleOne().

double evgen::MUSUN::sd = 0.
private

Definition at line 307 of file MUSUN_module.cc.

Referenced by endRun(), and SampleOne().

double evgen::MUSUN::se = 0.
private

Definition at line 304 of file MUSUN_module.cc.

Referenced by endRun(), and SampleOne().

double evgen::MUSUN::sp = 0.
private

Definition at line 306 of file MUSUN_module.cc.

Referenced by endRun(), and SampleOne().

double evgen::MUSUN::spmu[121][62][51]
private

Definition at line 297 of file MUSUN_module.cc.

Referenced by initialization(), and sampling().

double evgen::MUSUN::st = 0.
private

Definition at line 305 of file MUSUN_module.cc.

Referenced by endRun(), and SampleOne().

double evgen::MUSUN::the1
private

Definition at line 303 of file MUSUN_module.cc.

Referenced by initialization(), and sampling().

double evgen::MUSUN::the2
private

Definition at line 303 of file MUSUN_module.cc.

Referenced by initialization().

double evgen::MUSUN::theta
private

Definition at line 287 of file MUSUN_module.cc.

Referenced by beginJob(), initialization(), and SampleOne().

double evgen::MUSUN::Time
private

Definition at line 287 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::x0
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::y0
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().

double evgen::MUSUN::z0
private

Definition at line 289 of file MUSUN_module.cc.

Referenced by beginJob(), and SampleOne().


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