197 gErrorIgnoreLevel = kWarning;
215 const Decayer * hnlgen = dynamic_cast< const Decayer * >( algHNLGen );
216 const VertexGenerator * vtxGen = dynamic_cast< const VertexGenerator * >( algVtxGen );
218 bool geom_is_accessible = ! (gSystem->AccessPathName(
gOptRootGeom.c_str()));
219 if (!geom_is_accessible) {
221 <<
"The specified ROOT geometry doesn't exist! Initialization failed!";
226 if( !gOptRootGeoManager ) gOptRootGeoManager = TGeoManager::Import(
gOptRootGeom.c_str());
228 TGeoVolume * top_volume = gOptRootGeoManager->GetTopVolume();
229 assert( top_volume );
230 __attribute__((unused)) TGeoShape * ts = top_volume->GetShape();
239 std::vector<
double > U4l2s = hnlgen->GetHNLCouplings();
245 std::
string stIntChannels = hnlgen->GetHNLInterestingChannels();
int iChan = -1;
247 while( stIntChannels.size() > 0 ){
250 std::string tmpSt = stIntChannels.substr( stIntChannels.size()-1, stIntChannels.size() );
251 if( std::strcmp( tmpSt.c_str(),
"1" ) == 0 )
254 stIntChannels.erase( stIntChannels.end()-1, stIntChannels.end() );
265 <<
"Initialised Ntuple Writer";
268 ntpw.EventTree()->Branch(
"hnl_mass", &
gOptMassHNL,
"gOptMassHNL/D");
269 ntpw.EventTree()->Branch(
"hnl_coup_e", &
gOptECoupling,
"gOptECoupling/D");
270 ntpw.EventTree()->Branch(
"hnl_coup_m", &
gOptMCoupling,
"gOptMCoupling/D");
271 ntpw.EventTree()->Branch(
"hnl_coup_t", &
gOptTCoupling,
"gOptTCoupling/D");
272 ntpw.EventTree()->Branch(
"hnl_ismaj", &
gOptIsMajorana,
"gOptIsMajorana/I");
275 ntpw.EventTree()->Branch(
"hnl_IS_E", &
NTP_IS_E,
"NTP_IS_E/D");
276 ntpw.EventTree()->Branch(
"hnl_IS_PX", &
NTP_IS_PX,
"NTP_IS_PX/D");
277 ntpw.EventTree()->Branch(
"hnl_IS_PY", &
NTP_IS_PY,
"NTP_IS_PY/D");
278 ntpw.EventTree()->Branch(
"hnl_IS_PZ", &
NTP_IS_PZ,
"NTP_IS_PZ/D");
279 ntpw.EventTree()->Branch(
"hnl_FS0_PDG", &
NTP_FS0_PDG,
"NTP_FS0_PDG/I");
280 ntpw.EventTree()->Branch(
"hnl_FS0_E", &
NTP_FS0_E,
"NTP_FS0_E/D");
281 ntpw.EventTree()->Branch(
"hnl_FS0_PX", &
NTP_FS0_PX,
"NTP_FS0_PX/D");
282 ntpw.EventTree()->Branch(
"hnl_FS0_PY", &
NTP_FS0_PY,
"NTP_FS0_PY/D");
283 ntpw.EventTree()->Branch(
"hnl_FS0_PZ", &
NTP_FS0_PZ,
"NTP_FS0_PZ/D");
284 ntpw.EventTree()->Branch(
"hnl_FS1_PDG", &
NTP_FS1_PDG,
"NTP_FS1_PDG/I");
285 ntpw.EventTree()->Branch(
"hnl_FS1_E", &
NTP_FS1_E,
"NTP_FS1_E/D");
286 ntpw.EventTree()->Branch(
"hnl_FS1_PX", &
NTP_FS1_PX,
"NTP_FS1_PX/D");
287 ntpw.EventTree()->Branch(
"hnl_FS1_PY", &
NTP_FS1_PY,
"NTP_FS1_PY/D");
288 ntpw.EventTree()->Branch(
"hnl_FS1_PZ", &
NTP_FS1_PZ,
"NTP_FS1_PZ/D");
289 ntpw.EventTree()->Branch(
"hnl_FS2_PDG", &
NTP_FS2_PDG,
"NTP_FS2_PDG/I");
290 ntpw.EventTree()->Branch(
"hnl_FS2_E", &
NTP_FS2_E,
"NTP_FS2_E/D");
291 ntpw.EventTree()->Branch(
"hnl_FS2_PX", &
NTP_FS2_PX,
"NTP_FS2_PX/D");
292 ntpw.EventTree()->Branch(
"hnl_FS2_PY", &
NTP_FS2_PY,
"NTP_FS2_PY/D");
293 ntpw.EventTree()->Branch(
"hnl_FS2_PZ", &
NTP_FS2_PZ,
"NTP_FS2_PZ/D");
297 mcjmonitor.SetRefreshRate(RunOpt::Instance()->MCJobStatusRefreshRate());
300 <<
"Initialised MC job monitor";
303 GHepRecord::SetPrintLevel(RunOpt::Instance()->EventRecordPrintLevel());
305 #ifdef __CAN_USE_ROOT_GEOM__
310 #endif // #ifdef __CAN_USE_ROOT_GEOM__
318 <<
"\nPlease check ${GENIE}/config/CommonHNL.xml sections \"ParamSpace\" and \"ParticleGun\"";
329 if( ievent % (
gOptNev / 1000 ) == 0 ){
330 int irat = ievent / (
gOptNev / 1000 );
331 std::cerr << 0.1 * irat <<
" % " <<
" ( " << ievent
332 <<
" / " <<
gOptNev <<
" ) \r" << std::flush;
335 if( ievent % (
gOptNev / 10 ) == 0 ){
336 int irat = ievent / (
gOptNev / 10 );
337 std::cerr << 10.0 * irat <<
" % " <<
" ( " << ievent
338 <<
" / " <<
gOptNev <<
" ) \r" << std::flush;
345 <<
" *** Generating event............ " << ievent;
357 const std::map< HNLDecayMode_t, double > gammaMap = sh.GetValidChannels();
362 <<
"No decay mode specified - sampling from all available modes.";
370 event->AttachSummary(interaction);
378 event->AddParticle( ptHNL );
384 hnlgen->ProcessEventRecord(event);
385 vtxGen->ProcessEventRecord(event);
390 NTP_FS0_E = ((
event->Particle(1))->P4())->E();
391 NTP_FS0_PX = ((
event->Particle(1))->P4())->Px();
392 NTP_FS0_PY = ((
event->Particle(1))->P4())->Py();
393 NTP_FS0_PZ = ((
event->Particle(1))->P4())->Pz();
395 NTP_FS1_E = ((
event->Particle(2))->P4())->E();
396 NTP_FS1_PX = ((
event->Particle(2))->P4())->Px();
397 NTP_FS1_PY = ((
event->Particle(2))->P4())->Py();
398 NTP_FS1_PZ = ((
event->Particle(2))->P4())->Pz();
399 if( event->Particle(3) ){
401 NTP_FS2_E = ((
event->Particle(3))->P4())->E();
402 NTP_FS2_PX = ((
event->Particle(3))->P4())->Px();
403 NTP_FS2_PY = ((
event->Particle(3))->P4())->Py();
404 NTP_FS2_PZ = ((
event->Particle(3))->P4())->Pz();
423 <<
"Generated event: " << *event;
426 ntpw.AddEventRecord(ievent, event);
427 mcjmonitor.Update(ievent,event);
void RandGen(long int seed)
HNLDecayMode_t gOptDecayMode
TLorentzVector GeneratePosition(GHepRecord *event)
Heavy Neutral Lepton final-state product generator.
Heavy Neutral Lepton decay vertex generator given production vertex and momentum ***.
void SetProbeP4(const TLorentzVector &P4)
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
virtual void SetProbability(double prob)
Algorithm abstract base class.
TLorentzVector * GenerateOriginPosition(GHepRecord *event)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Summary information for an interaction.
Simple class to create & update MC job status files and env. vars. This is used to be able to keep tr...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
enum genie::hnl::EHNLDecayMode HNLDecayMode_t
TLorentzVector * GenerateOriginMomentum(GHepRecord *event)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records...
static __attribute__((unused)) double fDecayGammas[]
NtpMCFormat_t kDefOptNtpFormat
InitialState * InitStatePtr(void) const
int SelectDecayMode(std::vector< HNLDecayMode_t > *intChannels, SimpleHNL sh)
const char * AsString(Resonance_t res)
resonance id -> string
vector< vector< double > > clear
void MesgThresholds(string inpfile)
const EventRecordVisitorI * HNLGenerator(void)
void GetCommandLineArgs(int argc, char **argv)
The GENIE Algorithm Factory.
STDHEP-like event record entry that can fit a particle or a nucleus.
std::vector< HNLDecayMode_t > gOptIntChannels