LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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::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

 MUSUN (fhicl::ParameterSet const &pset)
 
virtual ~MUSUN ()
 
void produce (art::Event &evt)
 
void beginJob ()
 
void beginRun (art::Run &run)
 
void reconfigure (fhicl::ParameterSet const &p)
 
void endRun (art::Run &run)
 
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 Member Functions

void SampleOne (unsigned int i, simb::MCTruth &mct)
 
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)
 

Private Attributes

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 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 210 of file MUSUN_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.

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

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

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

Definition at line 333 of file MUSUN_module.cc.

334  {
335  this->reconfigure(pset);
336 
337  // create a default random engine; obtain the random seed from NuRandomService,
338  // unless overridden in configuration with key "Seed"
340  ->createEngine(*this, pset, "Seed");
341 
342  produces< std::vector<simb::MCTruth> >();
343  produces< sumdata::RunData, art::InRun >();
344  }
base_engine_t & createEngine(seed_t seed)
void reconfigure(fhicl::ParameterSet const &p)
evgen::MUSUN::~MUSUN ( )
virtual

Definition at line 346 of file MUSUN_module.cc.

347  {
348  }

Member Function Documentation

void evgen::MUSUN::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 395 of file MUSUN_module.cc.

References art::TFileDirectory::make().

396  {
397  // Make the Histograms....
399  /*
400  hPDGCode = tfs->make<TH1D>("hPDGCode" ,"PDG Code" ,30 , -15 , 15 );
401  hPositionX = tfs->make<TH1D>("hPositionX" ,"Position (cm)" ,500, ( fXmin - 10 ), ( fXmax + 10 ) );
402  hPositionY = tfs->make<TH1D>("hPositionY" ,"Position (cm)" ,500, ( fYmin - 10 ), ( fYmax + 10 ) );
403  hPositionZ = tfs->make<TH1D>("hPositionZ" ,"Position (cm)" ,500, ( fZmin - 10 ), ( fZmax + 10 ) );
404  hTime = tfs->make<TH1D>("hTime" ,"Time (s)" ,500, 0 , 1e6 );
405  hMomentumHigh = tfs->make<TH1D>("hMomentumHigh","Momentum (GeV)",500, fEmin, fEmax );
406  hMomentum = tfs->make<TH1D>("hMomentum" ,"Momentum (GeV)",500, fEmin, fEmin+1e3 );
407  hEnergyHigh = tfs->make<TH1D>("hEnergyHigh" ,"Energy (GeV)" ,500, fEmin, fEmax );
408  hEnergy = tfs->make<TH1D>("hEnergy" ,"Energy (GeV)" ,500, fEmin, fEmin+1e3 );
409  hDepth = tfs->make<TH1D>("hDepth" ,"Depth (m)" ,800, 0 , 14000 );
410 
411  hDirCosineX = tfs->make<TH1D>("hDirCosineX","Normalised Direction cosine",500, -1, 1 );
412  hDirCosineY = tfs->make<TH1D>("hDirCosineY","Normalised Direction cosine",500, -1, 1 );
413  hDirCosineZ = tfs->make<TH1D>("hDirCosineZ","Normalised Direction cosine",500, -1, 1 );
414 
415  hTheta = tfs->make<TH1D>("hTheta" ,"Angle (degrees)",500, 0, 90 );
416  hPhi = tfs->make<TH1D>("hPhi" ,"Angle (degrees)",500, 0, 365 );
417  */
418  fTree = tfs->make<TTree>("Generator","analysis tree");
419  fTree->Branch("particleID",&PdgCode, "particleID/I");
420  fTree->Branch("energy" ,&Energy , "energy/D");
421  fTree->Branch("time" ,&Time , "Time/D" );
422  fTree->Branch("posX" ,&x0 , "posX/D" );
423  fTree->Branch("posY" ,&y0 , "posY/D" );
424  fTree->Branch("posZ" ,&z0 , "posZ/D" );
425  fTree->Branch("cosX" ,&cx , "cosX/D" );
426  fTree->Branch("cosY" ,&cy , "cosY/D" );
427  fTree->Branch("cosZ" ,&cz , "cosZ/D" );
428  fTree->Branch("theta" ,&theta , "theta/D" );
429  fTree->Branch("phi" ,&phi , "phi/D" );
430  fTree->Branch("depth" ,&dep , "dep/D" );
431  /*
432  fCryos = tfs->make<TTree>("CryoSizes","cryo tree");
433  fCryos->Branch("NumTPCs" , &NumTPCs , "NumTPCs/I" );
434  fCryos->Branch("TPCMinX" , &TPCMinX , "TPCMinX[NumTPCs]/D");
435  fCryos->Branch("TPCMaxX" , &TPCMaxX , "TPCMaxX[NumTPCs]/D");
436  fCryos->Branch("TPCMinY" , &TPCMinY , "TPCMinY[NumTPCs]/D");
437  fCryos->Branch("TPCMaxY" , &TPCMaxY , "TPCMaxY[NumTPCs]/D");
438  fCryos->Branch("TPCMinZ" , &TPCMinZ , "TPCMinZ[NumTPCs]/D");
439  fCryos->Branch("TPCMaxZ" , &TPCMaxZ , "TPCMaxZ[NumTPCs]/D");
440  fCryos->Branch("CryoSize", &CryoSize, "CryoSize[6]/D" );
441  fCryos->Branch("DetHall" , &DetHall , "DetHall[6]/D" );
442  */
443  }
T * make(ARGS...args) const
void evgen::MUSUN::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 448 of file MUSUN_module.cc.

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

449  {
450  // grab the geometry object to see what geometry we are using
452  std::unique_ptr<sumdata::RunData> runcol(new sumdata::RunData(geo->DetectorName()));
453 
454  // Check fcl parameters were set correctly
455  if ( fThetamax > 90.5 ) throw cet::exception("MUSUNGen") << "\nThetamax has to be less than " << M_PI/2 << ", but was entered as " << fThetamax << ", this causes an error so leaving program now...\n\n";
456  if ( fThetamin < 0 ) throw cet::exception("MUSUNGen") << "\nThetamin has to be more than 0, but was entered as " << fThetamin << ", this causes an error so leaving program now...\n\n";
457  if ( fThetamax < fThetamin ) throw cet::exception("MUSUNGen") << "\nMinimum angle is bigger than maximum angle....causes an error so leaving program now....\n\n";
458  if ( fPhimax > 360.5 ) throw cet::exception("MUSUNGen") << "\nPhimax has to be less than " << 2*M_PI << ", but was entered as " << fPhimax << ", this cause an error so leaving program now...\n\n";
459  if ( fPhimin < 0 ) throw cet::exception("MUSUNGen") << "\nPhimin has to be more than 0, but was entered as " << fPhimin << ", this causes an error so leaving program now...\n\n";
460  if ( fPhimax < fPhimin) throw cet::exception("MUSUNGen") << "\nMinimum angle is bigger than maximum angle....causes an error so leaving program now....\n\n";
461  if ( fEmax < fEmin ) throw cet::exception("MUSUNGen") << "\nMinimum energy is bigger than maximum energy....causes an error so leaving program now....\n\n";
462 
463 
464  run.put(std::move(runcol));
465 
466  // area of the horizontal plane of the parallelepiped
467  s_hor = (fZmax-fZmin)*(fXmax-fXmin);
468  // area of the vertical plane of the parallelepiped, perpendicular to z-axis
469  s_ver1 = (fXmax-fXmin)*(fYmax-fYmin);
470  // area of the vertical plane of the parallelepiped, perpendicular to x-axis
471  s_ver2 = (fZmax-fZmin)*(fYmax-fYmin);
472 
473  //std::cout << s_hor << " " << s_ver1 << " " << s_ver2 << std::endl;
474 
476 
477  std::cout << "Material - SURF rock" << std::endl;
478  std::cout << "Density = " << fRockDensity << " g/cm^3" << std::endl;
479  std::cout << "Parameters for muon spectrum are from LVD best fit" << std::endl;
480  std::cout << "Muon energy range = " << fEmin << " - " << fEmax << " GeV" << std::endl;
481  std::cout << "Zenith angle range = " << fThetamin << " - " << fThetamax << " degrees" << std::endl;
482  std::cout << "Azimuthal angle range = " << fPhimin << " - " << fPhimax << " degrees" << std::endl;
483  std::cout << "Global intensity = " << FI << " (cm^2 s)^(-1) or s^(-1) (for muons on the surface)" << std::endl;
484  /*
485  NumTPCs = geo->NTPC(0);
486  std::cout << "There are " << NumTPCs << " in cryostat 0" << std::endl;
487  for (unsigned int c=0; c<geo->Ncryostats(); c++) {
488  const geo::CryostatGeo& cryostat=geo->Cryostat(c);
489  geo->CryostatBoundaries( CryoSize, 0 );
490  std::cout << "Cryo bounds " << CryoSize[0] << " "<< CryoSize[1] << " "<< CryoSize[2] << " "<< CryoSize[3] << " "<< CryoSize[4] << " "<< CryoSize[5] << std::endl;
491  for (unsigned int t=0; t<cryostat.NTPC(); t++) {
492  geo::TPCID id;
493  id.Cryostat=c;
494  id.TPC=t;
495  id.isValid=true;
496  const geo::TPCGeo& tpc=cryostat.TPC(id);
497  TPCMinX[t] = tpc.MinX();
498  TPCMaxX[t] = tpc.MaxX();
499  TPCMinY[t] = tpc.MinY();
500  TPCMaxY[t] = tpc.MaxY();
501  TPCMinZ[t] = tpc.MinZ();
502  TPCMaxZ[t] = tpc.MaxZ();
503  std::cout << t << "\t" << TPCMinX[t] << " " << TPCMaxX[t] << " " << TPCMinY[t] << " " << TPCMaxY[t] << " " << TPCMinZ[t] << " " << TPCMaxZ[t] << std::endl;
504  }
505  }
506  fCryos -> Fill();
507  */
508  return;
509  }
double fEmax
Maximum Kinetic Energy (GeV)
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
double fEmin
Minimum Kinetic Energy (GeV)
double fThetamin
Minimum theta.
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:148
double fRockDensity
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
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.
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 = 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
void evgen::MUSUN::endRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 514 of file MUSUN_module.cc.

515  {
516  std::cout << "\n\nNumber of muons = " << NEvents << std::endl;
517  std::cout << "Mean muon energy = " << se/NEvents << " GeV" << std::endl;
518  std::cout << "Mean zenith angle (theta) = " << st/NEvents << " degrees" << std::endl;
519  std::cout << "Mean azimuthal angle (phi)= " << sp/NEvents << " degrees" << std::endl;
520  std::cout << "Mean slant depth = " << sd/NEvents << " m w.e." << std::endl;
521  }
unsigned int NEvents
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
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 695 of file MUSUN_module.cc.

References e, and in.

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

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

526  {
528  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
529 
530  simb::MCTruth truth;
532 
533  ++NEvents;
534  SampleOne(NEvents,truth);
535 
536  LOG_DEBUG("MUSUN") << truth;
537 
538  truthcol->push_back(truth);
539 
540  evt.put(std::move(truthcol));
541 
542  return;
543  }
void SampleOne(unsigned int i, simb::MCTruth &mct)
unsigned int NEvents
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:78
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
single particles thrown at the detector
Definition: MCTruth.h:24
#define LOG_DEBUG(id)
Event generator information.
Definition: MCTruth.h:30
void evgen::MUSUN::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 353 of file MUSUN_module.cc.

References fhicl::ParameterSet::get().

354  {
355  // do not put seed in reconfigure because we don't want to reset
356  // the seed midstream
357 
358  fPDG = p.get< int >("PDG");
359  fChargeRatio = p.get< double >("ChargeRatio");
360 
361  fInputDir = p.get< std::string >("InputDir");
362  fInputFile1 = p.get< std::string >("InputFile1");
363  fInputFile2 = p.get< std::string >("InputFile2");
364  fInputFile3 = p.get< std::string >("InputFile3");
365 
366  fCavernAngle = p.get< double >("CavernAngle");
367  fRockDensity = p.get< double >("RockDensity");
368 
369  fEmin = p.get< double >("Emin");
370  fEmax = p.get< double >("Emax");
371 
372  fThetamin = p.get< double >("Thetamin");
373  fThetamax = p.get< double >("Thetamax");
374 
375  fPhimin = p.get< double >("Phimin");
376  fPhimax = p.get< double >("Phimax");
377 
378  figflag = p.get<int >("igflag");
379  fXmin = p.get<double >("Xmin");
380  fYmin = p.get<double >("Ymin");
381  fZmin = p.get<double >("Zmin");
382  fXmax = p.get<double >("Xmax");
383  fYmax = p.get<double >("Ymax");
384  fZmax = p.get<double >("Zmax");
385 
386  fT0 = p.get< double >("T0");
387  fSigmaT = p.get< double >("SigmaT");
388  fTDist = p.get< int >("TDist");
389 
390  return;
391  }
double fEmax
Maximum Kinetic Energy (GeV)
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
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 fT0
Central t position (ns) in world coordinates.
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)
double fThetamax
Maximum theta.
double fXmin
Minimum X position.
std::string fInputFile1
Input File 1.
double fXmax
Maximum X position.
void evgen::MUSUN::SampleOne ( unsigned int  i,
simb::MCTruth mct 
)
private

Definition at line 549 of file MUSUN_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), art::RandomNumberGenerator::getEngine(), part, and ss.

549  {
550 
551  // get the random number generator service and make some CLHEP generators
553  CLHEP::HepRandomEngine &engine = rng->getEngine();
554  CLHEP::RandFlat flat(engine);
555  CLHEP::RandGaussQ gauss(engine);
556 
557  Energy = 0;
558  theta = 0;
559  phi = 0;
560  dep = 0;
561  Time = 0;
562 
563  sampling( Energy, theta, phi, dep );
564 
565  theta = theta* M_PI/180;
566 
567  // changing the angle phi so z-axis is positioned along the long side
568  // of the cavern pointing at 14 deg from the North to the East.
569  // phi += (90. - 14.0);
570  // Want our co-ord rotation going from East to South.
571  phi += fCavernAngle;
572  if( phi >= 360. )
573  phi -= 360.;
574  if( phi < 0 )
575  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){
597  Time = gauss.fire(fT0, fSigmaT);
598  }
599  else {
600  Time = fT0 + fSigmaT*(2.0*flat.fire()-1.0);
601  }
602 
603  // The minus sign above is for y-axis pointing up, so the y-momentum
604  // is always pointing down
605  cx = -sin(theta)*sin(phi);
606  cy = -cos(theta);
607  cz = +sin(theta)*cos(phi);
608  Momentum = std::sqrt(Energy*Energy-m*m); // Get momentum
609  px0 = Momentum * cx;
610  py0 = Momentum * cy;
611  pz0 = Momentum * cz;
612  TLorentzVector pvec(px0, py0, pz0, Energy );
613 
614  // Muon coordinates
615  double sh1 = s_hor * cos(theta);
616  double sv1 = s_ver1 * sin(theta) * fabs(cos(phi));
617  double sv2 = s_ver2 * sin(theta) * fabs(sin(phi));
618  double ss = sh1 + sv1 + sv2;
619  double xfl1 = flat.fire();
620  if( xfl1 <= sh1/ss ) {
621  x0 = (fXmax - fXmin)*flat.fire() + fXmin;
622  y0 = fYmax;
623  z0 = (fZmax - fZmin)*flat.fire() + fZmin;
624  } else if( xfl1 <= (sh1+sv1)/ss ) {
625  x0 = (fXmax - fXmin)*flat.fire() + fXmin;
626  y0 = (fYmax - fYmin)*flat.fire() + fYmin;
627  if( cz >= 0 ) z0 = fZmax;
628  else z0 = fZmin;
629  } else {
630  if( cx >= 0 ) x0 = fXmin;
631  else x0 = fXmax;
632  y0 = (fYmax - fYmin)*flat.fire() + fYmin;
633  z0 = (fZmax - fZmin)*flat.fire() + fZmin;
634  }
635  // Make Lorentz vector for x and t....
636  TLorentzVector pos(x0, y0, z0, Time);
637 
638  // Parameters written to the file muons_surf_v2_test*.dat
639  // nmu - muon sequential number
640  // id_part - muon charge (10 - positive, 11 - negative )
641  // Energy - total muon energy in GeV assuming ultrarelativistic muons
642  // x0, y0, z0 - muon coordinates on the surface of parallelepiped
643  // specified above; x-axis and y-axis are pointing in the
644  // directions such that the angle phi (from the slant depth
645  // distribution files) is measured from x to y. z-axis is
646  // pointing upwards.
647  // cx, cy, cz - direction cosines.
648 
649  simb::MCParticle part(trackid, PdgCode, primary);
650  part.AddTrajectoryPoint(pos, pvec);
651 
652  mct.Add(part);
653 
654  theta = theta * 180/M_PI;
655  phi = phi * 180/M_PI;
656 
657  // Sum energies, angles, depth for average outputs.
658  se += Energy;
659  st += theta;
660  sp += phi;
661  sd += dep;
662 
663  // Fill Histograms.....
664  /*
665  hPDGCode ->Fill (PdgCode);
666  hPositionX ->Fill (x0);
667  hPositionY ->Fill (y0);
668  hPositionZ ->Fill (z0);
669  hTime ->Fill (Time);
670  hMomentumHigh ->Fill (Momentum);
671  hMomentum ->Fill (Momentum);
672  hEnergyHigh ->Fill (Energy);
673  hEnergy ->Fill (Energy);
674  hDepth ->Fill (dep);
675  hDirCosineX ->Fill (cx);
676  hDirCosineY ->Fill (cy);
677  hDirCosineZ ->Fill (cz);
678  hTheta ->Fill (theta);
679  hPhi ->Fill (phi);
680  */
681  /*
682  // Write event by event outsputs.....
683  std::cout << "Theta: " << theta << " Phi: " << phi << " Energy: " << Energy << " Momentum: " << Momentum << std::endl;
684  std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
685  std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
686  std::cout << "Normalised..." << cx << " " << cy << " " << cz << std::endl;
687  */
688  fTree->Fill();
689 
690  }
double fZmax
Maximum Z position.
double fYmax
Maximum Y position.
double fCavernAngle
Angle of the detector from the North to the East.
Float_t ss
Definition: plot.C:23
void Add(simb::MCParticle &part)
Definition: MCTruth.h:77
static const int kGAUS
double fT0
Central t position (ns) in world coordinates.
int fTDist
How to distribute t (gaus, or uniform)
base_engine_t & getEngine() const
int fPDG
PDG code of particles to generate.
void sampling(double &E, double &theta, double &phi, double &dep)
TString part[npart]
Definition: Style.C:32
double fChargeRatio
Charge ratio of particle / anti-particle.
double fYmin
Minimum Y position.
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
double fZmin
Minimum Z position.
double fSigmaT
Variation in t position (ns)
double fXmin
Minimum X position.
double fXmax
Maximum X position.
void evgen::MUSUN::sampling ( double &  E,
double &  theta,
double &  phi,
double &  dep 
)
private

Definition at line 888 of file MUSUN_module.cc.

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

889  {
890  // get the random number generator service and make some CLHEP generators
892  CLHEP::HepRandomEngine &engine = rng->getEngine();
893  CLHEP::RandFlat flat(engine);
894  CLHEP::RandGaussQ gauss(engine);
895 
896  #if 0 // this code is disabled for good
897  double xfl = flat.fire();
898  int loIndex = 0, hiIndex = 32400;
899  int i = (loIndex+hiIndex)/2;
900  bool foundIndex = false;
901  if( xfl < fnmu[loIndex] ) {
902  i = loIndex;
903  foundIndex = true;
904  } else if ( xfl > fnmu[hiIndex] ) {
905  i = hiIndex;
906  foundIndex = true;
907  } else if ( xfl > fnmu[i-1] && xfl <= fnmu[i] )
908  foundIndex = true;
909  while( !foundIndex ) {
910  if( xfl < fnmu[i] )
911  hiIndex = i;
912  else
913  loIndex = i;
914  i = (loIndex + hiIndex)/2;
915 
916  if( xfl > fnmu[i-1] && xfl <= fnmu[i] )
917  foundIndex = true;
918  }
919  #else
920  double xfl = flat.fire();
921  int i = 0;
922  while ( xfl > fnmu[i] ) ++i;
923  #endif
924  int ic = (i-2)/360;
925  int ip = i-2-ic*360;
926 
927  xfl = flat.fire();
928  theta = the1 + ((double)ic+xfl);
929  xfl = flat.fire();
930  phi = ph1 + ((double)ip+xfl);
931  if ( phi > 360 ) phi = phi -360;
932  dep = depth[ip][ic] * fRockDensity;
933 
934  int ic1 = cos(M_PI/180.*theta) * 50.;
935  if( ic1 < 0 )
936  ic1 = 0;
937  if( ic1 > 50 )
938  ic1 = 50;
939  int ip1 = dep / 200. - 16;
940  if( ip1 < 0 )
941  ip1 = 0;
942  if( ip1 > 61 )
943  ip1 = 61;
944 
945  xfl = flat.fire();
946  #if 0
947  loIndex = 0, hiIndex = 120;
948  int j = (loIndex+hiIndex)/2;
949  foundIndex = false;
950  if( xfl < spmu[loIndex][ip1][ic1] ) {
951  j = loIndex;
952  foundIndex = true;
953  } else if ( xfl > spmu[hiIndex][ip1][ic1] ) {
954  j = hiIndex;
955  foundIndex = true;
956  } else if ( xfl > spmu[j-1][ip1][ic1] && xfl <= spmu[j][ip1][ic1] )
957  foundIndex = true;
958  while( !foundIndex ) {
959  if( xfl < spmu[j][ip1][ic1] )
960  hiIndex = j;
961  else
962  loIndex = j;
963  j = (loIndex + hiIndex)/2;
964 
965  if( xfl > spmu[j-1][ip1][ic1] && xfl <= spmu[j][ip1][ic1] )
966  foundIndex = true;
967  }
968  #else
969  int j = 0;
970  while ( xfl > spmu[j][ip1][ic1] ) ++j;
971  #endif
972 
973  double En1 = 0.05 * (j-1);
974  double En2 = 0.05 * (j);
975  E = pow(10.,En1 + (En2 - En1)*flat.fire());
976 
977  return;
978  }
Float_t E
Definition: plot.C:23
double fRockDensity
base_engine_t & getEngine() const
double depth[360][91]
double spmu[121][62][51]
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
double fnmu[32401]
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

double evgen::MUSUN::cx
private

Definition at line 290 of file MUSUN_module.cc.

double evgen::MUSUN::cy
private

Definition at line 290 of file MUSUN_module.cc.

double evgen::MUSUN::cz
private

Definition at line 290 of file MUSUN_module.cc.

double evgen::MUSUN::dep
private

Definition at line 288 of file MUSUN_module.cc.

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

Definition at line 300 of file MUSUN_module.cc.

double evgen::MUSUN::Energy
private

Definition at line 288 of file MUSUN_module.cc.

double evgen::MUSUN::fCavernAngle
private

Angle of the detector from the North to the East.

Definition at line 243 of file MUSUN_module.cc.

double evgen::MUSUN::fChargeRatio
private

Charge ratio of particle / anti-particle.

Definition at line 236 of file MUSUN_module.cc.

double evgen::MUSUN::fEmax
private

Maximum Kinetic Energy (GeV)

Definition at line 250 of file MUSUN_module.cc.

double evgen::MUSUN::fEmin
private

Minimum Kinetic Energy (GeV)

Definition at line 249 of file MUSUN_module.cc.

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

Definition at line 293 of file MUSUN_module.cc.

int evgen::MUSUN::figflag
private

If want sampled from sphere or parallelepiped.

Definition at line 257 of file MUSUN_module.cc.

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

Input Directory.

Definition at line 238 of file MUSUN_module.cc.

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

Input File 1.

Definition at line 239 of file MUSUN_module.cc.

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

Input File 2.

Definition at line 240 of file MUSUN_module.cc.

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

Input File 3.

Definition at line 241 of file MUSUN_module.cc.

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

Definition at line 301 of file MUSUN_module.cc.

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

Definition at line 299 of file MUSUN_module.cc.

int evgen::MUSUN::fPDG
private

PDG code of particles to generate.

Definition at line 235 of file MUSUN_module.cc.

double evgen::MUSUN::fPhimax
private

Maximum phi.

Definition at line 255 of file MUSUN_module.cc.

double evgen::MUSUN::fPhimin
private

Minimum phi.

Definition at line 254 of file MUSUN_module.cc.

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 244 of file MUSUN_module.cc.

double evgen::MUSUN::fSigmaT
private

Variation in t position (ns)

Definition at line 266 of file MUSUN_module.cc.

double evgen::MUSUN::fT0
private

Central t position (ns) in world coordinates.

Definition at line 265 of file MUSUN_module.cc.

int evgen::MUSUN::fTDist
private

How to distribute t (gaus, or uniform)

Definition at line 267 of file MUSUN_module.cc.

double evgen::MUSUN::fThetamax
private

Maximum theta.

Definition at line 253 of file MUSUN_module.cc.

double evgen::MUSUN::fThetamin
private

Minimum theta.

Definition at line 252 of file MUSUN_module.cc.

TTree* evgen::MUSUN::fTree
private

Definition at line 313 of file MUSUN_module.cc.

double evgen::MUSUN::fXmax
private

Maximum X position.

Definition at line 261 of file MUSUN_module.cc.

double evgen::MUSUN::fXmin
private

Minimum X position.

Definition at line 258 of file MUSUN_module.cc.

double evgen::MUSUN::fYmax
private

Maximum Y position.

Definition at line 262 of file MUSUN_module.cc.

double evgen::MUSUN::fYmin
private

Minimum Y position.

Definition at line 259 of file MUSUN_module.cc.

double evgen::MUSUN::fZmax
private

Maximum Z position.

Definition at line 263 of file MUSUN_module.cc.

double evgen::MUSUN::fZmin
private

Minimum Z position.

Definition at line 260 of file MUSUN_module.cc.

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

Definition at line 233 of file MUSUN_module.cc.

double evgen::MUSUN::Momentum
private

Definition at line 289 of file MUSUN_module.cc.

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

Definition at line 310 of file MUSUN_module.cc.

int evgen::MUSUN::PdgCode
private

Definition at line 287 of file MUSUN_module.cc.

double evgen::MUSUN::ph1
private

Definition at line 304 of file MUSUN_module.cc.

double evgen::MUSUN::ph2
private

Definition at line 304 of file MUSUN_module.cc.

double evgen::MUSUN::phi
private

Definition at line 288 of file MUSUN_module.cc.

double evgen::MUSUN::px0
private

Definition at line 289 of file MUSUN_module.cc.

double evgen::MUSUN::py0
private

Definition at line 289 of file MUSUN_module.cc.

double evgen::MUSUN::pz0
private

Definition at line 289 of file MUSUN_module.cc.

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

Definition at line 294 of file MUSUN_module.cc.

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

Definition at line 295 of file MUSUN_module.cc.

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

Definition at line 296 of file MUSUN_module.cc.

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

Definition at line 308 of file MUSUN_module.cc.

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

Definition at line 305 of file MUSUN_module.cc.

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

Definition at line 307 of file MUSUN_module.cc.

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

Definition at line 298 of file MUSUN_module.cc.

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

Definition at line 306 of file MUSUN_module.cc.

double evgen::MUSUN::the1
private

Definition at line 304 of file MUSUN_module.cc.

double evgen::MUSUN::the2
private

Definition at line 304 of file MUSUN_module.cc.

double evgen::MUSUN::theta
private

Definition at line 288 of file MUSUN_module.cc.

double evgen::MUSUN::Time
private

Definition at line 288 of file MUSUN_module.cc.

double evgen::MUSUN::x0
private

Definition at line 290 of file MUSUN_module.cc.

double evgen::MUSUN::y0
private

Definition at line 290 of file MUSUN_module.cc.

double evgen::MUSUN::z0
private

Definition at line 290 of file MUSUN_module.cc.


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