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

Public Member Functions

 NucleonDecay (fhicl::ParameterSet const &p)
 
 NucleonDecay (NucleonDecay const &)=delete
 
 NucleonDecay (NucleonDecay &&)=delete
 
NucleonDecayoperator= (NucleonDecay const &)=delete
 
NucleonDecayoperator= (NucleonDecay &&)=delete
 
void produce (art::Event &e) override
 
void beginRun (art::Run &run) override
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

const genie::EventRecordVisitorImcgen
 
genie::NucleonDecayMode_t gOptDecayMode = genie::kNDNull
 
int dpdg = 0
 
CLHEP::RandFlat flatDist
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 51 of file NucleonDecay_module.cc.

Constructor & Destructor Documentation

evgen::NucleonDecay::NucleonDecay ( fhicl::ParameterSet const &  p)
explicit

Definition at line 79 of file NucleonDecay_module.cc.

81  // create a default random engine; obtain the random seed from NuRandomService,
82  // unless overridden in configuration with key "Seed"
83  , flatDist{art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, p, "Seed")}
84 {
85  genie::PDGLibrary::Instance(); //Ensure Messenger is started first in GENIE.
86 
87  string sname = "genie::EventGenerator";
88  string sconfig = "NucleonDecay";
89  // GENIE v3 needs a tune (even if irrelevant)
90  evgb::SetEventGeneratorListAndTune("Default","Default");
91 
93  mcgen =
94  dynamic_cast<const genie::EventRecordVisitorI *> (algf->GetAlgorithm(sname,sconfig));
95  if(!mcgen) {
96  throw cet::exception("NucleonDecay") << "Couldn't instantiate the nucleon decay generator";
97  }
98  int fDecayMode = p.get<int>("DecayMode");
100 
101  if (p.get<int>("DecayedNucleon") > 0 ){
102  dpdg = p.get<int>("DecayedNucleon");
103  }
104  else{
106  }
107 
108  produces< std::vector<simb::MCTruth> >();
109  produces< sumdata::RunData, art::InRun >();
110 
111  unsigned int seed = art::ServiceHandle<rndm::NuRandomService>()->getSeed();
113 }
void RandGen(long int seed)
Definition: AppInit.cxx:30
genie::NucleonDecayMode_t gOptDecayMode
CLHEP::RandFlat flatDist
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
const genie::EventRecordVisitorI * mcgen
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
p
Definition: test.py:223
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
static AlgFactory * Instance()
Definition: AlgFactory.cxx:64
enum genie::ENucleonDecayMode NucleonDecayMode_t
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
int DecayedNucleonPdgCode(NucleonDecayMode_t ndm)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evgen::NucleonDecay::NucleonDecay ( NucleonDecay const &  )
delete
evgen::NucleonDecay::NucleonDecay ( NucleonDecay &&  )
delete

Member Function Documentation

void evgen::NucleonDecay::beginRun ( art::Run run)
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 200 of file NucleonDecay_module.cc.

201 {
203  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()));
204 }
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
LArSoft geometry interface.
Definition: ChannelGeo.h:16
NucleonDecay& evgen::NucleonDecay::operator= ( NucleonDecay const &  )
delete
NucleonDecay& evgen::NucleonDecay::operator= ( NucleonDecay &&  )
delete
void evgen::NucleonDecay::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 115 of file NucleonDecay_module.cc.

116 {
117  // Implementation of required member function here.
119  int target = 1000180400; //Only use argon target
120  int decay = (int)gOptDecayMode;
122  event->AttachSummary(interaction);
123 
124  // Simulate decay
126 
127 // genie::Interaction *inter = event->Summary();
128 // const genie::InitialState &initState = inter->InitState();
129 // std::cout<<"initState = "<<initState.AsString()<<std::endl;
130 // const genie::ProcessInfo &procInfo = inter->ProcInfo();
131 // std::cout<<"procInfo = "<<procInfo.AsString()<<std::endl;
132  MF_LOG_DEBUG("NucleonDecay")
133  << "Generated event: " << *event;
134 
135  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
136  simb::MCTruth truth;
137 
139 
140  // Find boundary of active volume
141  double minx = 1e9;
142  double maxx = -1e9;
143  double miny = 1e9;
144  double maxy = -1e9;
145  double minz = 1e9;
146  double maxz = -1e9;
147  for (size_t i = 0; i<geo->NTPC(); ++i){
148  const geo::TPCGeo &tpc = geo->TPC(i);
149  if (minx>tpc.MinX()) minx = tpc.MinX();
150  if (maxx<tpc.MaxX()) maxx = tpc.MaxX();
151  if (miny>tpc.MinY()) miny = tpc.MinY();
152  if (maxy<tpc.MaxY()) maxy = tpc.MaxY();
153  if (minz>tpc.MinZ()) minz = tpc.MinZ();
154  if (maxz<tpc.MaxZ()) maxz = tpc.MaxZ();
155  }
156 
157  // Assign vertice position
158  double X0 = flatDist.fire( minx, maxx );
159  double Y0 = flatDist.fire( miny, maxy );
160  double Z0 = flatDist.fire( minz, maxz );
161 
162  TIter partitr(event);
163  genie::GHepParticle *part = 0;
164  // GHepParticles return units of GeV/c for p. the V_i are all in fermis
165  // and are relative to the center of the struck nucleus.
166  // add the vertex X/Y/Z to the V_i for status codes 0 and 1
167  int trackid = 0;
168  std::string primary("primary");
169 
170  while( (part = dynamic_cast<genie::GHepParticle *>(partitr.Next())) ){
171 
172  simb::MCParticle tpart(trackid,
173  part->Pdg(),
174  primary,
175  part->FirstMother(),
176  part->Mass(),
177  part->Status());
178 
179  TLorentzVector pos(X0, Y0, Z0, 0);
180  TLorentzVector mom(part->Px(), part->Py(), part->Pz(), part->E());
181  tpart.AddTrajectoryPoint(pos,mom);
182  if(part->PolzIsSet()) {
183  TVector3 polz;
184  part->GetPolarization(polz);
185  tpart.SetPolarization(polz);
186  }
187  tpart.SetRescatter(part->RescatterCode());
188  truth.Add(tpart);
189 
190  ++trackid;
191  }// end loop to convert GHepParticles to MCParticles
192  truth.SetOrigin(simb::kUnknown);
193  truthcol->push_back(truth);
194  //FillHistograms(truth);
195  e.put(std::move(truthcol));
196 
197  delete event;
198 }
genie::NucleonDecayMode_t gOptDecayMode
int RescatterCode(void) const
Definition: GHepParticle.h:65
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
double E(void) const
Get energy.
Definition: GHepParticle.h:91
CLHEP::RandFlat flatDist
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:82
std::string string
Definition: nybbler.cc:12
const genie::EventRecordVisitorI * mcgen
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
Geometry information for a single TPC.
Definition: TPCGeo.h:38
static Interaction * NDecay(int tgt, int decay_mode=-1, int decayed_nucleon=0)
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
int Pdg(void) const
Definition: GHepParticle.h:63
int FirstMother(void) const
Definition: GHepParticle.h:66
Summary information for an interaction.
Definition: Interaction.h:56
def move(depos, offset)
Definition: depos.py:107
double MinZ() const
Returns the world z coordinate of the start of the box.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
bool PolzIsSet(void) const
double MaxY() const
Returns the world y coordinate of the end of the box.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
void GetPolarization(TVector3 &polz)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:37
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
double MaxZ() const
Returns the world z coordinate of the end of the box.
#define MF_LOG_DEBUG(id)
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
Event generator information.
Definition: MCTruth.h:32
LArSoft geometry interface.
Definition: ChannelGeo.h:16
double MinY() const
Returns the world y coordinate of the start of the box.
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
Event finding and building.
double Py(void) const
Get Py.
Definition: GHepParticle.h:89

Member Data Documentation

int evgen::NucleonDecay::dpdg = 0
private

Definition at line 74 of file NucleonDecay_module.cc.

CLHEP::RandFlat evgen::NucleonDecay::flatDist
private

Definition at line 75 of file NucleonDecay_module.cc.

genie::NucleonDecayMode_t evgen::NucleonDecay::gOptDecayMode = genie::kNDNull
private

Definition at line 73 of file NucleonDecay_module.cc.

const genie::EventRecordVisitorI* evgen::NucleonDecay::mcgen
private

Definition at line 72 of file NucleonDecay_module.cc.


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