All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
evgen::NucleonDecay Class Reference
Inheritance diagram for evgen::NucleonDecay:

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
 

Private Attributes

const genie::EventRecordVisitorI * mcgen
 
genie::NucleonDecayMode_t gOptDecayMode = genie::kNDNull
 
int dpdg = 0
 
CLHEP::RandFlat flatDist
 

Detailed Description

Definition at line 52 of file NucleonDecay_module.cc.

Constructor & Destructor Documentation

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

Definition at line 80 of file NucleonDecay_module.cc.

81  : art::EDProducer{p}
82  // create a default random engine; obtain the random seed from NuRandomService,
83  // unless overridden in configuration with key "Seed"
84  , flatDist{art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, p, "Seed")}
CLHEP::RandFlat flatDist
pdgs p
Definition: selectors.fcl:22
evgen::NucleonDecay::NucleonDecay ( NucleonDecay const &  )
delete
evgen::NucleonDecay::NucleonDecay ( NucleonDecay &&  )
delete

Member Function Documentation

void evgen::NucleonDecay::beginRun ( art::Run &  run)
override

Definition at line 201 of file NucleonDecay_module.cc.

202 {
203  art::ServiceHandle<geo::Geometry const> geo;
204  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()));
205 }
NucleonDecay& evgen::NucleonDecay::operator= ( NucleonDecay const &  )
delete
NucleonDecay& evgen::NucleonDecay::operator= ( NucleonDecay &&  )
delete
void evgen::NucleonDecay::produce ( art::Event &  e)
override

Definition at line 116 of file NucleonDecay_module.cc.

117 {
118  // Implementation of required member function here.
119  genie::EventRecord * event = new genie::EventRecord;
120  int target = 1000180400; //Only use argon target
121  int decay = (int)gOptDecayMode;
122  genie::Interaction * interaction = genie::Interaction::NDecay(target,decay,dpdg);
123  event->AttachSummary(interaction);
124 
125  // Simulate decay
126  mcgen->ProcessEventRecord(event);
127 
128 // genie::Interaction *inter = event->Summary();
129 // const genie::InitialState &initState = inter->InitState();
130 // std::cout<<"initState = "<<initState.AsString()<<std::endl;
131 // const genie::ProcessInfo &procInfo = inter->ProcInfo();
132 // std::cout<<"procInfo = "<<procInfo.AsString()<<std::endl;
133  MF_LOG_DEBUG("NucleonDecay")
134  << "Generated event: " << *event;
135 
136  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
137  simb::MCTruth truth;
138 
139  art::ServiceHandle<geo::Geometry const> geo;
140 
141  // Find boundary of active volume
142  double minx = 1e9;
143  double maxx = -1e9;
144  double miny = 1e9;
145  double maxy = -1e9;
146  double minz = 1e9;
147  double maxz = -1e9;
148  for (size_t i = 0; i<geo->NTPC(); ++i){
149  const geo::TPCGeo &tpc = geo->TPC(i);
150  if (minx>tpc.MinX()) minx = tpc.MinX();
151  if (maxx<tpc.MaxX()) maxx = tpc.MaxX();
152  if (miny>tpc.MinY()) miny = tpc.MinY();
153  if (maxy<tpc.MaxY()) maxy = tpc.MaxY();
154  if (minz>tpc.MinZ()) minz = tpc.MinZ();
155  if (maxz<tpc.MaxZ()) maxz = tpc.MaxZ();
156  }
157 
158  // Assign vertice position
159  double X0 = flatDist.fire( minx, maxx );
160  double Y0 = flatDist.fire( miny, maxy );
161  double Z0 = flatDist.fire( minz, maxz );
162 
163  TIter partitr(event);
164  genie::GHepParticle *part = 0;
165  // GHepParticles return units of GeV/c for p. the V_i are all in fermis
166  // and are relative to the center of the struck nucleus.
167  // add the vertex X/Y/Z to the V_i for status codes 0 and 1
168  int trackid = 0;
169  std::string primary("primary");
170 
171  while( (part = dynamic_cast<genie::GHepParticle *>(partitr.Next())) ){
172 
173  simb::MCParticle tpart(trackid,
174  part->Pdg(),
175  primary,
176  part->FirstMother(),
177  part->Mass(),
178  part->Status());
179 
180  TLorentzVector pos(X0, Y0, Z0, 0);
181  TLorentzVector mom(part->Px(), part->Py(), part->Pz(), part->E());
182  tpart.AddTrajectoryPoint(pos,mom);
183  if(part->PolzIsSet()) {
184  TVector3 polz;
185  part->GetPolarization(polz);
186  tpart.SetPolarization(polz);
187  }
188  tpart.SetRescatter(part->RescatterCode());
189  truth.Add(tpart);
190 
191  ++trackid;
192  }// end loop to convert GHepParticles to MCParticles
193  truth.SetOrigin(simb::kUnknown);
194  truthcol->push_back(truth);
195  //FillHistograms(truth);
196  e.put(std::move(truthcol));
197 
198  delete event;
199 }
genie::NucleonDecayMode_t gOptDecayMode
CLHEP::RandFlat flatDist
process_name opdaq physics producers generator physics producers generator physics producers generator Z0
Definition: gen_protons.fcl:45
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
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
process_name opdaq physics producers generator physics producers generator Y0
Definition: gen_protons.fcl:45
standard_singlep gaussian distribution X0
Definition: multigen.fcl:8
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxY() const
Returns the world y coordinate of the end of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
do i e
double MinY() const
Returns the world y coordinate of the start of the box.

Member Data Documentation

int evgen::NucleonDecay::dpdg = 0
private

Definition at line 75 of file NucleonDecay_module.cc.

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

Definition at line 76 of file NucleonDecay_module.cc.

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

Definition at line 74 of file NucleonDecay_module.cc.

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

Definition at line 73 of file NucleonDecay_module.cc.


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