LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evgen::NUANCEGen Class Reference

A module to check the results from the Monte Carlo generator. More...

Inheritance diagram for evgen::NUANCEGen:
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

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

std::string ParticleStatus (int StatusCode)
 
std::string ReactionChannel (int ccnc, int mode)
 
void FillHistograms (simb::MCTruth mc)
 

Private Attributes

std::string fNuanceFile
 
double fBeamVerticalAngle
 
std::unique_ptr< std::ifstream > fEventFile
 
TStopwatch fStopwatch
 
std::string fNUANCEModuleLabel
 keep track of how long it takes to run the job More...
 
TH1F * fGenerated [6]
 Spectra as generated. More...
 
TH1F * fVertexX
 vertex location of generated events in x More...
 
TH1F * fVertexY
 vertex location of generated events in y More...
 
TH1F * fVertexZ
 vertex location of generated events in z More...
 
TH2F * fVertexXY
 vertex location in xy More...
 
TH2F * fVertexXZ
 vertex location in xz More...
 
TH2F * fVertexYZ
 vertex location in yz More...
 
TH1F * fDCosX
 direction cosine in x More...
 
TH1F * fDCosY
 direction cosine in y More...
 
TH1F * fDCosZ
 direction cosine in z More...
 
TH1F * fMuMomentum
 momentum of outgoing muons More...
 
TH1F * fMuDCosX
 direction cosine of outgoing mu in x More...
 
TH1F * fMuDCosY
 direction cosine of outgoing mu in y More...
 
TH1F * fMuDCosZ
 direction cosine of outgoing mu in z More...
 
TH1F * fEMomentum
 momentum of outgoing electrons More...
 
TH1F * fEDCosX
 direction cosine of outgoing e in x More...
 
TH1F * fEDCosY
 direction cosine of outgoing e in y More...
 
TH1F * fEDCosZ
 direction cosine of outgoing e in z More...
 
TH1F * fCCMode
 CC interaction mode. More...
 
TH1F * fNCMode
 CC interaction mode. More...
 
TH1F * fECons
 histogram to determine if energy is conserved in the event More...
 

Detailed Description

A module to check the results from the Monte Carlo generator.

Definition at line 58 of file NUANCEGen_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::NUANCEGen::NUANCEGen ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 121 of file NUANCEGen_module.cc.

References fEventFile, fNuanceFile, fStopwatch, art::errors::NotFound, and reconfigure().

122  {
123  this->reconfigure(pset);
124  fStopwatch.Start();
125 
126  produces< std::vector<simb::MCTruth> >();
127  produces< sumdata::RunData, art::InRun >();
128 
129  mf::LogInfo("NUANCEGen") << "Reading events from '" << fNuanceFile << "'";
130  fEventFile = std::make_unique<std::ifstream>(fNuanceFile.c_str());
131  if (!(fEventFile->good())) {
133  << "Failed to open input file '" << fNuanceFile << "'.\n";
134  }
135  }
std::string fNuanceFile
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void reconfigure(fhicl::ParameterSet const &p)
std::unique_ptr< std::ifstream > fEventFile
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
evgen::NUANCEGen::~NUANCEGen ( )
virtual

Definition at line 138 of file NUANCEGen_module.cc.

References fStopwatch.

139  {
140  fStopwatch.Stop();
141  }

Member Function Documentation

void evgen::NUANCEGen::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 152 of file NUANCEGen_module.cc.

References geo::GeometryCore::DetHalfHeight(), geo::GeometryCore::DetHalfWidth(), geo::GeometryCore::DetLength(), fCCMode, fDCosX, fDCosY, fDCosZ, fECons, fEDCosX, fEDCosY, fEDCosZ, fEMomentum, fGenerated, fMuDCosX, fMuDCosY, fMuDCosZ, fMuMomentum, fNCMode, fVertexX, fVertexXY, fVertexXZ, fVertexY, fVertexYZ, fVertexZ, art::TFileDirectory::make(), x, y, and z.

152  {
153 
154  // Get access to the TFile service.
156 
157  fGenerated[0] = tfs->make<TH1F>("fGenerated_necc","", 100, 0.0, 20.0);
158  fGenerated[1] = tfs->make<TH1F>("fGenerated_nebcc","", 100, 0.0, 20.0);
159  fGenerated[2] = tfs->make<TH1F>("fGenerated_nmcc","", 100, 0.0, 20.0);
160  fGenerated[3] = tfs->make<TH1F>("fGenerated_nmbcc","", 100, 0.0, 20.0);
161  fGenerated[4] = tfs->make<TH1F>("fGenerated_nnc","", 100, 0.0, 20.0);
162  fGenerated[5] = tfs->make<TH1F>("fGenerated_nbnc","", 100, 0.0, 20.0);
163 
164  fDCosX = tfs->make<TH1F>("fDCosX", ";dx/ds", 200, -1., 1.);
165  fDCosY = tfs->make<TH1F>("fDCosY", ";dy/ds", 200, -1., 1.);
166  fDCosZ = tfs->make<TH1F>("fDCosZ", ";dz/ds", 200, -1., 1.);
167 
168  fMuMomentum = tfs->make<TH1F>("fMuMomentum", ";p_{#mu} (GeV/c)", 500, 0., 50.);
169  fMuDCosX = tfs->make<TH1F>("fMuDCosX", ";dx/ds;", 200, -1., 1.);
170  fMuDCosY = tfs->make<TH1F>("fMuDCosY", ";dy/ds;", 200, -1., 1.);
171  fMuDCosZ = tfs->make<TH1F>("fMuDCosZ", ";dz/ds;", 200, -1., 1.);
172 
173  fEMomentum = tfs->make<TH1F>("fEMomentum", ";p_{e} (GeV/c)", 500, 0., 50.);
174  fEDCosX = tfs->make<TH1F>("fEDCosX", ";dx/ds;", 200, -1., 1.);
175  fEDCosY = tfs->make<TH1F>("fEDCosY", ";dy/ds;", 200, -1., 1.);
176  fEDCosZ = tfs->make<TH1F>("fEDCosZ", ";dz/ds;", 200, -1., 1.);
177 
178  fCCMode = tfs->make<TH1F>("fCCMode", ";CC Interaction Mode;", 5, 0., 5.);
179  fCCMode->GetXaxis()->SetBinLabel(1, "QE");
180  fCCMode->GetXaxis()->SetBinLabel(2, "Res");
181  fCCMode->GetXaxis()->SetBinLabel(3, "DIS");
182  fCCMode->GetXaxis()->SetBinLabel(4, "Coh");
183  fCCMode->GetXaxis()->SetBinLabel(5, "kInverseMuDecay");
184  fCCMode->GetXaxis()->CenterLabels();
185 
186  fNCMode = tfs->make<TH1F>("fNCMode", ";NC Interaction Mode;", 5, 0., 5.);
187  fNCMode->GetXaxis()->SetBinLabel(1, "QE");
188  fNCMode->GetXaxis()->SetBinLabel(2, "Res");
189  fNCMode->GetXaxis()->SetBinLabel(3, "DIS");
190  fNCMode->GetXaxis()->SetBinLabel(4, "Coh");
191  fNCMode->GetXaxis()->SetBinLabel(5, "kNuElectronElastic");
192  fNCMode->GetXaxis()->CenterLabels();
193 
194  //fDeltaE = tfs->make<TH1F>("fDeltaE", ";#Delta E_{#nu} (GeV);", 200, -1., 1.);
195  fECons = tfs->make<TH1F>("fECons", ";#Delta E(#nu,lepton);", 500, -5., 5.);
196 
198  double x = 2.1*geo->DetHalfWidth();
199  double y = 2.1*geo->DetHalfHeight();
200  double z = 2.*geo->DetLength();
201  int xdiv = TMath::Nint(2*x/5.);
202  int ydiv = TMath::Nint(2*y/5.);
203  int zdiv = TMath::Nint(2*z/5.);
204 
205  fVertexX = tfs->make<TH1F>("fVertexX", ";x (cm)", xdiv, -x, x);
206  fVertexY = tfs->make<TH1F>("fVertexY", ";y (cm)", ydiv, -y, y);
207  fVertexZ = tfs->make<TH1F>("fVertexZ", ";z (cm)", zdiv, -0.2*z, z);
208 
209  fVertexXY = tfs->make<TH2F>("fVertexXY", ";x (cm);y (cm)", xdiv, -x, x, ydiv, -y, y);
210  fVertexXZ = tfs->make<TH2F>("fVertexXZ", ";z (cm);x (cm)", zdiv, -0.2*z, z, xdiv, -x, x);
211  fVertexYZ = tfs->make<TH2F>("fVertexYZ", ";z (cm);y (cm)", zdiv, -0.2*z, z, ydiv, -y, y);
212 
213  }
Float_t x
Definition: compare.C:6
TH1F * fVertexX
vertex location of generated events in x
TH2F * fVertexYZ
vertex location in yz
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
TH2F * fVertexXY
vertex location in xy
Float_t y
Definition: compare.C:6
TH1F * fDCosY
direction cosine in y
TH1F * fEMomentum
momentum of outgoing electrons
Double_t z
Definition: plot.C:279
TH1F * fECons
histogram to determine if energy is conserved in the event
TH1F * fGenerated[6]
Spectra as generated.
TH1F * fNCMode
CC interaction mode.
TH2F * fVertexXZ
vertex location in xz
TH1F * fDCosZ
direction cosine in z
TH1F * fCCMode
CC interaction mode.
TH1F * fDCosX
direction cosine in x
TH1F * fEDCosX
direction cosine of outgoing e in x
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
TH1F * fMuDCosY
direction cosine of outgoing mu in y
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
TH1F * fEDCosZ
direction cosine of outgoing e in z
TH1F * fMuMomentum
momentum of outgoing muons
T * make(ARGS...args) const
TH1F * fMuDCosX
direction cosine of outgoing mu in x
TH1F * fEDCosY
direction cosine of outgoing e in y
Namespace collecting geometry-related classes utilities.
TH1F * fVertexY
vertex location of generated events in y
TH1F * fVertexZ
vertex location of generated events in z
void evgen::NUANCEGen::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 216 of file NUANCEGen_module.cc.

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

217  {
218 
219  // grab the geometry object to see what geometry we are using
221  std::unique_ptr<sumdata::RunData> runcol(new sumdata::RunData(geo->DetectorName()));
222 
223  run.put(std::move(runcol));
224 
225  return;
226  }
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:148
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Namespace collecting geometry-related classes utilities.
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

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

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

Definition at line 162 of file Consumer.h.

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

Definition at line 172 of file Consumer.h.

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

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

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

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

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

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

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
void evgen::NUANCEGen::endJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 229 of file NUANCEGen_module.cc.

References fEventFile.

230  {
231  fEventFile->close();
232  }
std::unique_ptr< std::ifstream > fEventFile
void evgen::NUANCEGen::FillHistograms ( simb::MCTruth  mc)
private

look for the outgoing lepton in the particle stack just interested in the first one

Definition at line 577 of file NUANCEGen_module.cc.

References simb::MCNeutrino::CCNC(), DEFINE_ART_MODULE, simb::MCParticle::E(), energy, fCCMode, fDCosX, fDCosY, fDCosZ, fECons, fEDCosX, fEDCosY, fEDCosZ, fEMomentum, fGenerated, fMuDCosX, fMuDCosY, fMuDCosZ, fMuMomentum, fNCMode, fVertexX, fVertexXY, fVertexXZ, fVertexY, fVertexYZ, fVertexZ, simb::MCTruth::GetNeutrino(), simb::MCTruth::GetParticle(), simb::kCC, art::left(), simb::MCNeutrino::Mode(), simb::MCTruth::NParticles(), simb::MCNeutrino::Nu(), simb::MCParticle::P(), part, ParticleStatus(), simb::MCParticle::PdgCode(), simb::MCParticle::Px(), simb::MCParticle::Py(), simb::MCParticle::Pz(), ReactionChannel(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), and simb::MCParticle::Vz().

Referenced by produce().

578  {
579  // Decide which histograms to put the spectrum in
580  int id = -1;
581  if (mc.GetNeutrino().CCNC()==simb::kCC) {
582  fCCMode->Fill(mc.GetNeutrino().Mode());
583  if (mc.GetNeutrino().Nu().PdgCode() == 12) id = 0;
584  else if (mc.GetNeutrino().Nu().PdgCode() == -12) id = 1;
585  else if (mc.GetNeutrino().Nu().PdgCode() == 14) id = 2;
586  else if (mc.GetNeutrino().Nu().PdgCode() == -14) id = 3;
587  else return;
588  }
589  else {
590  fNCMode->Fill(mc.GetNeutrino().Mode());
591  if (mc.GetNeutrino().Nu().PdgCode() > 0) id = 4;
592  else id = 5;
593  }
594  if (id==-1) abort();
595 
596  // Fill the specta histograms
597  fGenerated[id]->Fill(mc.GetNeutrino().Nu().E() );
598 
599  //< fill the vertex histograms from the neutrino - that is always
600  //< particle 0 in the list
601  simb::MCNeutrino mcnu = mc.GetNeutrino();
602  const simb::MCParticle nu = mcnu.Nu();
603 
604  fVertexX->Fill(nu.Vx());
605  fVertexY->Fill(nu.Vy());
606  fVertexZ->Fill(nu.Vz());
607 
608  fVertexXY->Fill(nu.Vx(), nu.Vy());
609  fVertexXZ->Fill(nu.Vz(), nu.Vx());
610  fVertexYZ->Fill(nu.Vz(), nu.Vy());
611 
612  double mom = nu.P();
613  if(std::abs(mom) > 0.){
614  fDCosX->Fill(nu.Px()/mom);
615  fDCosY->Fill(nu.Py()/mom);
616  fDCosZ->Fill(nu.Pz()/mom);
617  }
618 
619 
620 // LOG_DEBUG("GENIEInteractionInformation")
621 // << std::endl
622 // << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(),mc.GetNeutrino().Mode())
623 // << std::endl
624 // << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl
625 // << std::setiosflags(std::ios::left)
626 // << std::setw(20) << "PARTICLE"
627 // << std::setiosflags(std::ios::left)
628 // << std::setw(32) << "STATUS"
629 // << std::setw(18) << "E (GeV)"
630 // << std::setw(18) << "m (GeV/c2)"
631 // << std::setw(18) << "Ek (GeV)"
632 // << std::endl << std::endl;
633 
634 // const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
635 
636 // // Loop over the particle stack for this event
637 // for(int i = 0; i < mc.NParticles(); ++i){
638 // simb::MCParticle part(mc.GetParticle(i));
639 // std::string name = databasePDG->GetParticle(part.PdgCode())->GetName();
640 // int code = part.StatusCode();
641 // std::string status = ParticleStatus(code);
642 // double mass = part.Mass();
643 // double energy = part.E();
644 // double Ek = (energy-mass); // Kinetic Energy (GeV)
645 // if(status=="kIStFinalStB4Interactions")
646 // LOG_DEBUG("GENIEFinalState")
647 // << std::setiosflags(std::ios::left) << std::setw(20) << name
648 // << std::setiosflags(std::ios::left) << std::setw(32) <<status
649 // << std::setw(18)<< energy
650 // << std::setw(18)<< mass
651 // << std::setw(18)<< Ek <<std::endl;
652 // else
653 // LOG_DEBUG("GENIEFinalState")
654 // << std::setiosflags(std::ios::left) << std::setw(20) << name
655 // << std::setiosflags(std::ios::left) << std::setw(32) << status
656 // << std::setw(18) << energy
657 // << std::setw(18) << mass <<std::endl;
658 
659  std::cout << "REACTION: " << ReactionChannel(mc.GetNeutrino().CCNC(),mc.GetNeutrino().Mode()) << std::endl;
660  std::cout << "-----------> Particles in the Stack = " << mc.NParticles() << std::endl;
661  std::cout << std::setiosflags(std::ios::left)
662  << std::setw(20) << "PARTICLE"
663  << std::setiosflags(std::ios::left)
664  << std::setw(32) << "STATUS"
665  << std::setw(18) << "E (GeV)"
666  << std::setw(18) << "m (GeV/c2)"
667  << std::setw(18) << "Ek (GeV)"
668  << std::endl << std::endl;
669 
670  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
671 
672  // Loop over the particle stack for this event
673  for(int i = 0; i < mc.NParticles(); ++i){
675  std::string name;
676  if (part.PdgCode() == 18040)
677  name = "Ar40 18040";
678  else if (part.PdgCode() != -99999 )
679  {
680  name = databasePDG->GetParticle(part.PdgCode())->GetName();
681  }
682 
683  int code = part.StatusCode();
684  std::string status = ParticleStatus(code);
685  double mass = part.Mass();
686  double energy = part.E();
687  double Ek = (energy-mass); // Kinetic Energy (GeV)
688 
689  std::cout << std::setiosflags(std::ios::left) << std::setw(20) << name
690  << std::setiosflags(std::ios::left) << std::setw(32) <<status
691  << std::setw(18)<< energy
692  << std::setw(18)<< mass
693  << std::setw(18)<< Ek <<std::endl;
694  }
695 
696 
697  if(mc.GetNeutrino().CCNC() == simb::kCC){
698 
701  for(int i = 0; i < mc.NParticles(); ++i){
703  if(abs(part.PdgCode()) == 11){
704  fEMomentum->Fill(part.P());
705  fEDCosX->Fill(part.Px()/part.P());
706  fEDCosY->Fill(part.Py()/part.P());
707  fEDCosZ->Fill(part.Pz()/part.P());
708  fECons->Fill(nu.E() - part.E());
709  break;
710  }
711  else if(abs(part.PdgCode()) == 13){
712  fMuMomentum->Fill(part.P());
713  fMuDCosX->Fill(part.Px()/part.P());
714  fMuDCosY->Fill(part.Py()/part.P());
715  fMuDCosZ->Fill(part.Pz()/part.P());
716  fECons->Fill(nu.E() - part.E());
717  break;
718  }
719  }// end loop over particles
720  }//end if CC interaction
721 
722  return;
723  }
double E(const int i=0) const
Definition: MCParticle.h:237
TH1F * fVertexX
vertex location of generated events in x
TH2F * fVertexYZ
vertex location in yz
int PdgCode() const
Definition: MCParticle.h:216
int CCNC() const
Definition: MCNeutrino.h:152
TH1F * fMuDCosZ
direction cosine of outgoing mu in z
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:74
double Py(const int i=0) const
Definition: MCParticle.h:235
TH2F * fVertexXY
vertex location in xy
TH1F * fDCosY
direction cosine in y
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:150
TH1F * fEMomentum
momentum of outgoing electrons
double Px(const int i=0) const
Definition: MCParticle.h:234
TH1F * fECons
histogram to determine if energy is conserved in the event
TH1F * fGenerated[6]
Spectra as generated.
TH1F * fNCMode
CC interaction mode.
TH2F * fVertexXZ
vertex location in xz
int NParticles() const
Definition: MCTruth.h:72
std::string ParticleStatus(int StatusCode)
TH1F * fDCosZ
direction cosine in z
TH1F * fCCMode
CC interaction mode.
TH1F * fDCosX
direction cosine in x
TH1F * fEDCosX
direction cosine of outgoing e in x
TH1F * fMuDCosY
direction cosine of outgoing mu in y
std::string ReactionChannel(int ccnc, int mode)
double P(const int i=0) const
Definition: MCParticle.h:238
TString part[npart]
Definition: Style.C:32
double energy
Definition: plottest35.C:25
TH1F * fEDCosZ
direction cosine of outgoing e in z
TH1F * fMuMomentum
momentum of outgoing muons
const simb::MCParticle & GetParticle(int i) const
Definition: MCTruth.h:73
double Vx(const int i=0) const
Definition: MCParticle.h:225
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
double Pz(const int i=0) const
Definition: MCParticle.h:236
TH1F * fMuDCosX
direction cosine of outgoing mu in x
double Vz(const int i=0) const
Definition: MCParticle.h:227
TH1F * fEDCosY
direction cosine of outgoing e in y
Event generator information.
Definition: MCNeutrino.h:18
int Mode() const
Definition: MCNeutrino.h:153
TH1F * fVertexY
vertex location of generated events in y
double Vy(const int i=0) const
Definition: MCParticle.h:226
TH1F * fVertexZ
vertex location of generated events in z
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

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

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

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

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

Definition at line 56 of file ProducerBase.h.

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

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

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

Definition at line 190 of file Consumer.h.

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

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

Definition at line 205 of file Consumer.h.

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

Definition at line 215 of file Consumer.h.

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

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

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
std::string evgen::NUANCEGen::ParticleStatus ( int  StatusCode)
private

Definition at line 525 of file NUANCEGen_module.cc.

References sim::ParticleStatusName().

Referenced by FillHistograms().

526  {
527  int code = StatusCode;
528  std::string ParticleStatusName;
529 
530  switch(code)
531  {
532  case 0:
533  ParticleStatusName = "kIStInitialState";
534  break;
535  case 1:
536  ParticleStatusName = "kIStFinalState";
537  break;
538  case 11:
539  ParticleStatusName = "kIStNucleonTarget";
540  break;
541  default:
542  ParticleStatusName = "Status Unknown";
543  }
544  return ParticleStatusName;
545  }
std::string ParticleStatusName(int code)
Describes the status of a particle (simb::MCParticle::StatusCode()).
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::NUANCEGen::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 234 of file NUANCEGen_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), geo::GeometryCore::DetHalfWidth(), geo::GeometryCore::DetLength(), energy, art::EventID::event(), fBeamVerticalAngle, fEventFile, FillHistograms(), simb::MCTruth::GetNeutrino(), art::Event::id(), in, simb::kBeamNeutrino, simb::kCC, simb::kCCCOH, simb::kCCDIS, simb::kCCQE, simb::kCCQEHyperon, simb::kCoh, simb::kDIS, simb::kInverseMuDecay, simb::kNC, simb::kNCCOH, simb::kNCDIS, simb::kNCQE, simb::kNuanceOffset, simb::kNuElectronElastic, simb::kQE, simb::kRes, simb::kResCCNuBarDelta0PiMinus, simb::kResCCNuBarDeltaMinusPiPlus, simb::kResCCNuBarKaon0Lambda0, simb::kResCCNuBarNeutronEta, simb::kResCCNuBarNeutronPi0Pi0, simb::kResCCNuBarNeutronPiMinus, simb::kResCCNuBarNeutronPiPlusPiMinus, simb::kResCCNuBarNeutronRho0, simb::kResCCNuBarNeutronRhoMinus, simb::kResCCNuBarProtonPi0Pi0, simb::kResCCNuBarProtonPiMinus, simb::kResCCNuBarSigma0Kaon0, simb::kResCCNuBarSigmaMinusKaon0, simb::kResCCNuDelta2PlusPiMinus, simb::kResCCNuDeltaPlusPiPlus, simb::kResCCNuKaonPlusLambda0, simb::kResCCNuNeutronPiPlus, simb::kResCCNuNeutronRhoPlus, simb::kResCCNuProtonEta, simb::kResCCNuProtonPi0Pi0, simb::kResCCNuProtonPiPlus, simb::kResCCNuProtonPiPlusPiMinus, simb::kResCCNuProtonRhoPlus, simb::kResCCNuSigmaPlusKaon0, simb::kResCCNuSigmaPlusKaonPlus, simb::kUnUsed1, simb::kUnUsed2, PI, art::Event::put(), simb::MCTruth::SetNeutrino(), simb::MCTruth::SetOrigin(), x, X, y, Y, and Z.

235  {
236 
237  std::cout << std::endl;
238  std::cout<<"------------------------------------------------------------------------------"<<std::endl;
239 // std::cout << "run : " << evt.Header().Run() << std::endl;
240 // std::cout << "subrun : " << evt.Header().Subrun() << std::endl;
241 // std::cout << "event : " << evt.Header().Event() << std::endl;
242  std::cout << "event : " << evt.id().event() << std::endl;
243 
244  double X = 0.; // vertex position from Nuance
245  double Y = 0.; // vertex position from Nuance
246  double Z = 0.; // vertex position from Nuance
247  double PDGCODE = -9999.;
248  double CHANNEL = -9999.;
249  int channel = -9999;
250  double energy = 0.; // in MeV from Nuance
251  double cosx = 0.;
252  double cosy = 0.;
253  double cosz = 0.;
254  std::string name, k, dollar;
255  int partnumber = 0;
256 
257  int trackid = -1; // set track id to -i as these are all primary particles and have id <= 0
258  std::string primary("primary");
259  int FirstMother = -1;
260  double Mass = -9999;
261  int Status = -9999;
262 
263 
264  int ccnc = -9999;
265  int mode = -9999;
266  int targetnucleusPdg = -9999;
267  int hitquarkPdg = -9999;
268 
269  double P; // momentum of MCParticle in GeV/c
270  TLorentzVector Neutrino;
271  TLorentzVector Lepton;
272  TLorentzVector Target;
273  TLorentzVector q;
274  TLorentzVector Hadron4mom;
275 
276  double InvariantMass = -9999;
277  double x = -9999;
278  double y = -9999;
279  double Q2 = -9999;
280 
281  int Tpdg = 0; // for target
282  double Tmass = 0;
283  int Tstatus = 11;
284  double Tcosx = 0., Tcosy = 0., Tcosz = 0., Tenergy = 0.;
285  TLorentzVector Tpos;
286  double M = 0;
287 
288  // rotated direction cosines
289  double CosX = 0;
290  double CosY = 0;
291  double CosZ = 0;
292 
293 
294  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
295  simb::MCTruth truth;
296 
297  if(!fEventFile->good())
298  std::cout << "NuanceFile: Problem reading nuance file" << std::endl;
299 
300  while(getline(*fEventFile,k)){
301  std::istringstream in;
302  in.clear();
303  in.str(k);
304 
305  in>>dollar>>name>>PDGCODE>>energy>>cosx>>cosy>>cosz>>partnumber;
306  //std::cout<<std::setprecision(9)<<dollar<<" "<<name<<" "<<PDGCODE<<" "<<energy<<" "<<cosx<<" "<<cosy<<" "<<cosz<<" "<<partnumber<<std::endl;
307 
308  //get the nuance channel number
309  if(name == "nuance"){
310  CHANNEL = PDGCODE;
311  channel = int (CHANNEL);
312  channel = abs(channel)+ simb::kNuanceOffset;
313  //std::cout << "channel = " << channel << std::endl;
314 
315  //set the interaction type; CC or NC
316  if ( abs(channel) == simb::kCCQE
317  || ( abs(channel) >= simb::kResCCNuProtonPiPlus && abs(channel) <= simb::kResCCNuNeutronPiPlus )
318  || ( abs(channel) >= simb::kResCCNuBarNeutronPiMinus && abs(channel) <= simb::kResCCNuBarProtonPiMinus )
319  || ( abs(channel) >= simb::kResCCNuDeltaPlusPiPlus && abs(channel) <= simb::kResCCNuDelta2PlusPiMinus )
320  || ( abs(channel) >= simb::kResCCNuBarDelta0PiMinus && abs(channel) <= simb::kResCCNuBarDeltaMinusPiPlus )
321  || ( abs(channel) >= simb::kResCCNuProtonRhoPlus && abs(channel) <= simb::kResCCNuNeutronRhoPlus )
322  || ( abs(channel) >= simb::kResCCNuBarNeutronRhoMinus && abs(channel) <= simb::kResCCNuBarNeutronRho0 )
323  || ( abs(channel) >= simb::kResCCNuSigmaPlusKaonPlus && abs(channel) <= simb::kResCCNuSigmaPlusKaon0 )
324  || ( abs(channel) >= simb::kResCCNuBarSigmaMinusKaon0 && abs(channel) <= simb::kResCCNuBarSigma0Kaon0 )
325  || abs(channel) == simb::kResCCNuProtonEta
326  || abs(channel) == simb::kResCCNuBarNeutronEta
327  || abs(channel) == simb::kResCCNuKaonPlusLambda0
328  || abs(channel) == simb::kResCCNuBarKaon0Lambda0
329  || ( abs(channel) >= simb::kResCCNuProtonPiPlusPiMinus && abs(channel) <= simb::kResCCNuProtonPi0Pi0 )
330  || ( abs(channel) >= simb::kResCCNuBarNeutronPiPlusPiMinus && abs(channel) <= simb::kResCCNuBarNeutronPi0Pi0 )
331  || abs(channel) == simb::kCCDIS || abs(channel) == simb::kCCQEHyperon
332  || abs(channel) == simb::kCCCOH || abs(channel) == simb::kInverseMuDecay )
333  ccnc = simb::kCC;
334 
335  else if ( abs(channel) != simb::kUnUsed1 && abs(channel) != simb::kUnUsed2 )
336  ccnc = simb::kNC;
337 
338  //set the interaction mode; QE, Res, DIS, Coh, kNuElectronElastic, kInverseMuDecay
339  if ( abs(channel) == simb::kCCQE || abs(channel) == simb::kNCQE || abs(channel) == simb::kCCQEHyperon )
340  mode = simb::kQE;
341  else if ( abs(channel) >= simb::kResCCNuProtonPiPlus && abs(channel) <= simb::kResCCNuBarProtonPi0Pi0 )
342  mode = simb::kRes;
343  else if ( abs(channel) == simb::kCCDIS || abs(channel) == simb::kNCDIS )
344  mode = simb::kDIS;
345  else if ( abs(channel) == simb::kNCCOH || abs(channel) == simb::kCCCOH )
346  mode = simb::kCoh;
347  else if ( abs(channel) == simb::kNuElectronElastic )
348  mode = 4;
349  else if ( abs(channel) == simb::kInverseMuDecay )
350  mode = 5;
351 
352  } // if(name == "nuance")
353 
354 
355  //get the nuance vertex position:
356  if(name == "vertex"){
357  X = PDGCODE;
358  Y = energy;
359  Z = cosx;
360  //std::cout << "vertex from nuance = " << X << " " << Y << " " << Z << std::endl;
361  }
362 
363  double PI = 3.14159265;
364 
365  CosX = cosx;
366  CosY = (TMath::Cos(fBeamVerticalAngle*PI/180)*cosy)+(TMath::Sin(fBeamVerticalAngle*PI/180)*cosz);
367  CosZ = (-TMath::Sin(fBeamVerticalAngle*PI/180)*cosy)+(TMath::Cos(fBeamVerticalAngle*PI/180)*cosz);
368 
369  //get the target info
370  if(name == "track" && (PDGCODE == 2212 || PDGCODE == 2112 || PDGCODE == 18040 || PDGCODE == 11) && partnumber == -1){
371  Tpdg = int (PDGCODE);
372 
373  if ( PDGCODE == 18040 ){
374  Tmass = 37.5593438; // GeV
375  }
376 
377  else {
378  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
379  const TParticlePDG* definition = databasePDG->GetParticle(Tpdg);
380  Tmass = definition->Mass();
381  }
382 
383  Tenergy = energy;
384  Tcosx = CosX;
385  Tcosy = CosY;
386  Tcosz = CosZ;
387  }
388 
389  //get mcparticles other than target
390  if(name == "track" && (
391  partnumber == 0 ||
392  (partnumber == -1 && (PDGCODE != 2212 && PDGCODE != 2112 && PDGCODE != 18040 && PDGCODE != 11))
393  )
394  ){
395 
396  int pdgcode = int (PDGCODE);
397  //std::cout << "pdgcode = " << pdgcode << std::endl;
398 
399  if ( PDGCODE == 18040 )
400  Mass = 37.5593438; // GeV
401 
402  else {
403  const TDatabasePDG* databasePDG = TDatabasePDG::Instance();
404  const TParticlePDG* definition = databasePDG->GetParticle(pdgcode);
405  Mass = definition->Mass(); // GeV
406  }
407 
408  if(partnumber == -1)
409  Status = 0;
410 
411  if(partnumber == 0)
412  Status = 1;
413 
414  simb::MCParticle mcpart(trackid,
415  pdgcode,
416  primary,
417  FirstMother,
418  Mass,
419  Status
420  );
421 
422  P = std::sqrt(pow(energy/1000,2.) - pow(Mass,2.)); // GeV/c
423  //std::cout << "Momentum = " << P << std::endl;
424 
426 
427  double X0 = X + geo->DetHalfWidth();
428  double Y0 = Y;
429  double Z0 = Z + 0.5*geo->DetLength();
430 
431  TLorentzVector pos(X0, Y0, Z0, 0);
432  Tpos = pos; // for target
433 
434  TLorentzVector mom(CosX*P, CosY*P, CosZ*P, energy/1000);
435 
436  mcpart.AddTrajectoryPoint(pos,mom);
437  truth.Add(mcpart);
438 
439 
440  if(name == "track" && (abs(pdgcode) == 14 || abs(pdgcode) == 12) && partnumber == -1)
441  Neutrino.SetPxPyPzE(CosX*P, CosY*P, CosZ*P, energy/1000);
442 
443  if(name == "track" && (abs(pdgcode) == 13 || abs(pdgcode) == 11 || abs(pdgcode) == 14 || abs(pdgcode) == 12) && partnumber == 0)
444  Lepton.SetPxPyPzE(CosX*P, CosY*P, CosZ*P, energy/1000);
445 
446  }// loop over particles in an event. (excluding target)
447 
448  if(name == "end"){
449  break;
450  }
451 
452  } // end while loop
453 
454 
456 
457  //adding the target to mcparticle
458  simb::MCParticle mcpart(trackid,
459  Tpdg,
460  primary,
461  FirstMother,
462  Tmass,
463  Tstatus
464  );
465 
466  TLorentzVector Tmom;
467  Tmom.SetPxPyPzE(Tcosx, Tcosy, Tcosz, Tenergy/1000); // target momentum coordinates make a unit vector, may be modified later, does not effect the event simulation
468 
469  mcpart.AddTrajectoryPoint(Tpos,Tmom);
470  truth.Add(mcpart);
471 
472 // std::cout<<"Neutrino 4-Momentum = "
473 // <<Neutrino.Px()<<" "
474 // << Neutrino.Py()<<" "
475 // <<Neutrino.Pz()<<" "
476 // <<Neutrino.E()<<std::endl;
477 
478 // std::cout << "Target 4-Momentum = "
479 // << Target.Px() << " "
480 // << Target.Py() << " "
481 // << Target.Pz()<< " "
482 // << Target.E() << std::endl;
483 
484 // std::cout << "4-momentum of Lepton = "
485 // << Lepton.Px() << " "
486 // << Lepton.Py() << " "
487 // << Lepton.Pz() << " "
488 // << Lepton.E() << std::endl;
489 
490  M = Tmass;
491  q = Neutrino - Lepton;
492  Q2 = -(q*q);
493 
494  double v = q.E();
495  x = Q2/ (2*M*v);
496  y = v/ Neutrino.E();
497  double W2 = M*M + 2*M*v - Q2;
498  InvariantMass = TMath::Sqrt(TMath::Max(0.,W2));
499 
500  if(mode == simb::kCoh){
501  x = -1;
502  y = -1;
503  InvariantMass = -1;
504  }
505 
507  truth.SetNeutrino(ccnc, mode, channel,
508  targetnucleusPdg,
509  Tpdg,
510  hitquarkPdg,
511  //InvariantMass, x, y, Q2
512  InvariantMass, x, y, Q2
513  );
514 
515  std::cout << truth.GetNeutrino() << std::endl;
516 
517  truthcol->push_back(truth);
518  FillHistograms(truth);
519  evt.put(std::move(truthcol));
520 
521  return;
522  }
Float_t x
Definition: compare.C:6
neutral current quasi-elastic
Definition: MCNeutrino.h:101
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:74
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
charged current deep inelastic scatter
Definition: MCNeutrino.h:138
resonant charged current, nubar p -> l+ p pi-
Definition: MCNeutrino.h:111
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:78
neutrino electron elastic scatter
Definition: MCNeutrino.h:144
Float_t y
Definition: compare.C:6
Float_t Y
Definition: plot.C:39
offset to account for adding in Nuance codes to this enum
Definition: MCNeutrino.h:99
void SetNeutrino(int CCNC, int mode, int interactionType, int target, int nucleon, int quark, double w, double x, double y, double qsqr)
Definition: MCTruth.cxx:30
charged current quasi-elastic
Definition: MCNeutrino.h:100
void Add(simb::MCParticle &part)
Definition: MCTruth.h:77
constexpr double PI
Float_t Z
Definition: plot.C:39
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
resonant charged current, nu n -> l- n pi+
Definition: MCNeutrino.h:104
void FillHistograms(simb::MCTruth mc)
double energy
Definition: plottest35.C:25
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
std::unique_ptr< std::ifstream > fEventFile
charged current deep inelastic scatter
Definition: MCNeutrino.h:137
resonant charged current, nu p -> l- p pi+
Definition: MCNeutrino.h:102
ifstream in
Definition: comparison.C:7
charged current coherent pion
Definition: MCNeutrino.h:143
inverse muon decay
Definition: MCNeutrino.h:145
resonant charged current, nubar n -> l+ n pi-
Definition: MCNeutrino.h:109
EventNumber_t event() const
Definition: EventID.h:117
Event generator information.
Definition: MCTruth.h:30
Float_t X
Definition: plot.C:39
Namespace collecting geometry-related classes utilities.
EventID id() const
Definition: Event.h:56
Beam neutrinos.
Definition: MCTruth.h:21
std::string evgen::NUANCEGen::ReactionChannel ( int  ccnc,
int  mode 
)
private

Definition at line 549 of file NUANCEGen_module.cc.

Referenced by FillHistograms().

550  {
551  std::string ReactionChannelName=" ";
552 
553  if(ccnc==0)
554  ReactionChannelName = "kCC";
555  else if(ccnc==1)
556  ReactionChannelName = "kNC";
557  else std::cout<<"Current mode unknown!! "<<std::endl;
558 
559  if(mode==0)
560  ReactionChannelName += "_kQE";
561  else if(mode==1)
562  ReactionChannelName += "_kRes";
563  else if(mode==2)
564  ReactionChannelName += "_kDIS";
565  else if(mode==3)
566  ReactionChannelName += "_kCoh";
567  else if(mode==4)
568  ReactionChannelName += "_kNuElectronElastic";
569  else if(mode==5)
570  ReactionChannelName += "_kInverseMuDecay";
571  else std::cout<<"interaction mode unknown!! "<<std::endl;
572 
573  return ReactionChannelName;
574  }
void evgen::NUANCEGen::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 144 of file NUANCEGen_module.cc.

References fBeamVerticalAngle, fNuanceFile, and fhicl::ParameterSet::get().

Referenced by NUANCEGen().

145  {
146  fNuanceFile =(p.get< std::string >("NuanceFile"));
147  fBeamVerticalAngle =(p.get< double >("BeamVerticalAngle"));
148  return;
149  }
std::string fNuanceFile
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::NUANCEGen::fBeamVerticalAngle
private

Definition at line 77 of file NUANCEGen_module.cc.

Referenced by produce(), and reconfigure().

TH1F* evgen::NUANCEGen::fCCMode
private

CC interaction mode.

Definition at line 108 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fDCosX
private

direction cosine in x

Definition at line 94 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fDCosY
private

direction cosine in y

Definition at line 95 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fDCosZ
private

direction cosine in z

Definition at line 96 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fECons
private

histogram to determine if energy is conserved in the event

Definition at line 113 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fEDCosX
private

direction cosine of outgoing e in x

Definition at line 104 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fEDCosY
private

direction cosine of outgoing e in y

Definition at line 105 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fEDCosZ
private

direction cosine of outgoing e in z

Definition at line 106 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fEMomentum
private

momentum of outgoing electrons

Definition at line 103 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

std::unique_ptr<std::ifstream> evgen::NUANCEGen::fEventFile
private

Definition at line 78 of file NUANCEGen_module.cc.

Referenced by endJob(), NUANCEGen(), and produce().

TH1F* evgen::NUANCEGen::fGenerated[6]
private

Spectra as generated.

Definition at line 84 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fMuDCosX
private

direction cosine of outgoing mu in x

Definition at line 99 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fMuDCosY
private

direction cosine of outgoing mu in y

Definition at line 100 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fMuDCosZ
private

direction cosine of outgoing mu in z

Definition at line 101 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fMuMomentum
private

momentum of outgoing muons

Definition at line 98 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fNCMode
private

CC interaction mode.

Definition at line 109 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

std::string evgen::NUANCEGen::fNuanceFile
private

Definition at line 76 of file NUANCEGen_module.cc.

Referenced by NUANCEGen(), and reconfigure().

std::string evgen::NUANCEGen::fNUANCEModuleLabel
private

keep track of how long it takes to run the job

Definition at line 82 of file NUANCEGen_module.cc.

TStopwatch evgen::NUANCEGen::fStopwatch
private

Definition at line 79 of file NUANCEGen_module.cc.

Referenced by NUANCEGen(), and ~NUANCEGen().

TH1F* evgen::NUANCEGen::fVertexX
private

vertex location of generated events in x

Definition at line 86 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::NUANCEGen::fVertexXY
private

vertex location in xy

Definition at line 90 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::NUANCEGen::fVertexXZ
private

vertex location in xz

Definition at line 91 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fVertexY
private

vertex location of generated events in y

Definition at line 87 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH2F* evgen::NUANCEGen::fVertexYZ
private

vertex location in yz

Definition at line 92 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().

TH1F* evgen::NUANCEGen::fVertexZ
private

vertex location of generated events in z

Definition at line 88 of file NUANCEGen_module.cc.

Referenced by beginJob(), and FillHistograms().


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