EvtKinNuModule Class Reference

A module for generating nu interaction in MINOS. More...

#include <EvtKinNuModule.h>

Inheritance diagram for EvtKinNuModule:
JobCModule

List of all members.

Public Member Functions

 EvtKinNuModule ()
virtual ~EvtKinNuModule ()
JobCResult Get (MomNavigator *mom)
void BeginJob ()
void EndJob ()
void Report ()
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Member Functions

VldContext GetNextVldContext ()

Private Attributes

Detector::Detector_t fDetector
UShort_t fRun
UShort_t fSubRun
UShort_t fRunType
UInt_t fTrigSrc
Int_t fSpillType
Int_t fSnarl
Int_t fTimeFrame
NuTransport fNuTransport
Int_t fMinSnarlDump
Int_t fMaxSnarlDump
Int_t fStdHepDumpMode

Detailed Description

A module for generating nu interaction in MINOS.

Author:
(last to touch it)
Author
rhatcher
Version:
Revision
1.4
Date:
Date
2006/05/25 05:13:05

Contact: rhatcher@fnal.gov

Id
EvtKinNuModule.h,v 1.4 2006/05/25 05:13:05 rhatcher Exp

Definition at line 30 of file EvtKinNuModule.h.


Constructor & Destructor Documentation

EvtKinNuModule::EvtKinNuModule (  ) 

Definition at line 32 of file EvtKinNuModule.cxx.

References Msg::kDebug, and MSG.

00033     : JobCModule(),
00034       fDetector(Detector::kUnknown),
00035       fRun(0), fSubRun(0), fRunType(0), fTrigSrc(0), fSpillType(0),
00036       fSnarl(0), fTimeFrame(0),
00037       fMinSnarlDump(-1), fMaxSnarlDump(-1), fStdHepDumpMode(-1)
00038 {
00039     MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule constructor" << endl;
00040 }

EvtKinNuModule::~EvtKinNuModule (  )  [virtual]

Definition at line 44 of file EvtKinNuModule.cxx.

References Msg::kDebug, and MSG.

00045 {
00046     MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule destructor" << endl;
00047 }


Member Function Documentation

void EvtKinNuModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 51 of file EvtKinNuModule.cxx.

References NuTransport::Adopt(), InteractionGenerator::Configure(), FluxGenerator::Configure(), FlavorModifier::Configure(), EvtKinFactory::CreateFlavorModifier(), EvtKinFactory::CreateFluxGenerator(), EvtKinFactory::CreateInteractionGenerator(), fNuTransport, Registry::Get(), JobCModule::GetConfig(), GetNextVldContext(), gGeoManager, UgliLoanPool::Instance(), EvtKinFactory::Instance(), Msg::kDebug, LoadMinosPDG(), MSG, EvtKinFactory::Print(), NuTransport::Set(), and UgliLoanPool::SetUseGeo().

00052 {
00053     MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule BeginJob" << endl;
00054 
00055     EvtKinFactory::Instance().Print();
00056 
00057     LoadMinosPDG();
00058 
00059     Registry& r = GetConfig();
00060 
00061     // flux generator
00062     const char* fstr = "none";
00063     this->GetConfig().Get("Flux",fstr);
00064     FluxGenerator* flux = 
00065         EvtKinFactory::Instance().CreateFluxGenerator(fstr);
00066     const char* fconfig = "";
00067     r.Get("FluxConfig",fconfig);
00068     flux->Configure(fconfig);
00069     FluxGenerator* oldflux = fNuTransport.Adopt(flux);
00070     if (oldflux) delete oldflux;
00071 
00072     // flavor modifier
00073     const char* mstr = "none";
00074     this->GetConfig().Get("Flavor",mstr);
00075     FlavorModifier* flavor = 
00076         EvtKinFactory::Instance().CreateFlavorModifier(mstr);
00077     const char* mconfig = "";
00078     r.Get("FlavorConfig",mconfig);
00079     flavor->Configure(mconfig);
00080     FlavorModifier* oldflavor = fNuTransport.Adopt(flavor);
00081     if (oldflavor) delete oldflavor;
00082 
00083     // interaction generator
00084     const char* istr = "none";
00085     this->GetConfig().Get("Interaction",istr);
00086     InteractionGenerator* inter = 
00087         EvtKinFactory::Instance().CreateInteractionGenerator(istr);
00088     const char* iconfig = "";
00089     r.Get("InterConfig",iconfig);
00090     inter->Configure(iconfig);
00091     InteractionGenerator* oldinter = fNuTransport.Adopt(inter);
00092     if (oldinter) delete oldinter;
00093 
00094     VldContext vldc = GetNextVldContext();
00095     // Force GeoGeometry (TGeo) style geometry
00096     UgliLoanPool::Instance()->SetUseGeo(true);
00097     int buildgeo = 1;
00098     r.Get("BuildGeometry",buildgeo);
00099     if (buildgeo) UgliGeomHandle ugh(vldc);
00100     fNuTransport.Set(gGeoManager);
00101 
00102 }

void EvtKinNuModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 171 of file EvtKinNuModule.cxx.

References bfld::AsString(), fDetector, fMaxSnarlDump, fMinSnarlDump, fRun, fRunType, fSnarl, fSpillType, fStdHepDumpMode, fSubRun, fTimeFrame, fTrigSrc, Registry::Get(), Registry::GetCharString(), Msg::kInfo, MSG, and Detector::StringToEnum().

00172 {
00173 //======================================================================
00174 // Configure the module using the registry r
00175 //======================================================================
00176   int  tmpi;
00177   const char* tmpcs = 0;
00178 
00179   if (r.Get("Detector",   tmpcs)) fDetector   = Detector::StringToEnum(tmpcs);
00180   if (r.Get("Run",        tmpi))  fRun        = tmpi;
00181   if (r.Get("SubRun",     tmpi))  fSubRun     = tmpi;
00182   if (r.Get("RunType",    tmpi))  fRunType    = tmpi;
00183   if (r.Get("TrigSrc",    tmpi))  fTrigSrc    = tmpi;
00184   if (r.Get("SpillType",  tmpi))  fSpillType  = tmpi;
00185   if (r.Get("Snarl",      tmpi))  fSnarl      = tmpi;
00186   if (r.Get("TimeFrame",  tmpi))  fTimeFrame  = tmpi;
00187 
00188   r.Get("MinSnarlDump",  fMinSnarlDump);
00189   r.Get("MaxSnarlDump",  fMaxSnarlDump);
00190   r.Get("StdHepDumpMode",fStdHepDumpMode);
00191 
00192 
00193   MSG("EvtKin",Msg::kInfo)
00194       << "EvtKinNuModule::Config() " << endl
00195       << "  Detector " << Detector::AsString(fDetector)
00196       << " Run " << fRun << " SubRun " << fSubRun 
00197       << " RunType " << fRunType << " TrigSrc " << fTrigSrc
00198       << " SpillType " << fSpillType << endl
00199       << "  Next:  Snarl " << fSnarl << " TimeFrame " << fTimeFrame
00200       << endl;
00201 
00202   MSG("EvtKin",Msg::kInfo)
00203       << "  Flux: " << r.GetCharString("Flux") << endl
00204       << "  Flavor: " << r.GetCharString("Flavor") << endl
00205       << "  Interaction: " << r.GetCharString("Interaction") << endl;
00206 
00207 }

const Registry & EvtKinNuModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 120 of file EvtKinNuModule.cxx.

References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00121 {
00122 //======================================================================
00123 // The default configuration for this module
00124 //======================================================================
00125   //int itrue  = 1; // Work around for Registry's lack of bool
00126   int ifalse = 0; // Work around for Registry's lack of bool
00127 
00128   static Registry r;
00129    
00130   std::string name = this->GetName();
00131   name += ".config.default";
00132   r.SetName(name.c_str());
00133    
00134   r.UnLockValues();
00135   r.Set("Detector",         "Near");
00136 
00137   r.Set("Run",               9999);
00138   r.Set("SubRun",               0);
00139   r.Set("RunType",              0); // need to set this
00140   r.Set("TrigSrc",              0); // need to set this
00141   r.Set("SpillType",            0); // need to set this
00142 
00143   r.Set("Snarl",                0); // next snarl #
00144   r.Set("TimeFrame",            0); // next timeframe #
00145 
00146   r.Set("Flux",       "FluxGen_OneOverE");
00147   r.Set("FluxConfig", "seed=123 Emin=0.10 Emax=100 Xlo=-700 Xhi=+700");
00148 
00149   r.Set("Flavor",       "FlavorMod_None");
00150   //r.Set("Flavor",       "FlavorMod_Random");
00151   r.Set("FlavorConfig", "");
00152 
00153   r.Set("Interaction","InterGen_Neugen");
00154   r.Set("InterConfig","");
00155   //r.Set("InterConfig","ConfigName='MODBYRS' ConfigVersion=2 "
00156   //                    " RecalcXsec=0 "
00157   //                    " Models='DISMODEL=2 DISRES_OVERLAP=1' "
00158   //                    " Params='QEL_MA=1.032 RES_MA=1.032'");
00159 
00160   r.Set("BuildGeometry",    ifalse);
00161   r.Set("MinSnarlDump",      -1);
00162   r.Set("MaxSnarlDump",      -1);
00163   r.Set("StdHepDumpMode",    -1);
00164   r.LockValues();
00165  
00166   return r;
00167 }

void EvtKinNuModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 106 of file EvtKinNuModule.cxx.

References Msg::kDebug, and MSG.

00107 {
00108     MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule EndJob" << endl;
00109 }

JobCResult EvtKinNuModule::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 211 of file EvtKinNuModule.cxx.

References RecDataRecord< T >::AdoptComponent(), MomNavigator::AdoptFragment(), NuTransport::CreateStdHepList(), StdHepUtil::dumpStdHepList(), fMaxSnarlDump, fMinSnarlDump, fNuTransport, fRun, fRunType, fSnarl, fSpillType, fStdHepDumpMode, fSubRun, fTimeFrame, fTrigSrc, NuTransport::GenerateEvent(), GetNextVldContext(), RecRecordImp< T >::GetTempTags(), gSystem(), hostname, JobCResult::kAOK, Msg::kDebug, MSG, Registry::Set(), and SimSnarlHeader::TrimCodename().

00212 {
00213 //======================================================================
00214 // Generate an interaction.
00215 //======================================================================
00216 
00217   // We need a VldContext
00218   VldContext vldc = GetNextVldContext();
00219   MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule Reco " << vldc << endl;
00220 
00221   // Start a Record
00222   Int_t errcode = 0;
00223   Int_t currentSnarl = fSnarl++;
00224   VldTimeStamp now;
00225   std::string  codename = SimSnarlHeader::TrimCodename("$Name:  $");
00226   std::string  hostname(gSystem->HostName());
00227 
00228   SimSnarlHeader simheader(vldc,fRun,fSubRun,fRunType,errcode,
00229                            currentSnarl,fTrigSrc,fTimeFrame++,fSpillType,
00230                            now,codename,hostname);
00231   SimSnarlRecord* simrec = new SimSnarlRecord(simheader);
00232   // give the it to MOM to hold as a "fragment"
00233   simrec->GetTempTags().Set("stream","SimSnarl");
00234   simrec->GetTempTags().Set("index",fSnarl-1);
00235   mom->AdoptFragment(simrec);
00236 
00237   // Now start to fill the record
00238   fNuTransport.GenerateEvent();
00239   TClonesArray* stdhep_list = fNuTransport.CreateStdHepList();
00240   stdhep_list->SetName("StdHep");
00241   simrec->AdoptComponent(stdhep_list);
00242 
00243   if (currentSnarl >= fMinSnarlDump && currentSnarl <= fMaxSnarlDump)
00244       StdHepUtil::dumpStdHepList(stdhep_list,fStdHepDumpMode);
00245 
00246   return JobCResult::kAOK;
00247 }

VldContext EvtKinNuModule::GetNextVldContext (  )  [private]

Definition at line 251 of file EvtKinNuModule.cxx.

References fDetector, and SimFlag::kMC.

Referenced by BeginJob(), and Get().

00252 {
00253 //======================================================================
00254 // Generate a vldcontext
00255 //======================================================================
00256     return VldContext(fDetector,SimFlag::kMC,VldTimeStamp());
00257 }

void EvtKinNuModule::Report (  )  [virtual]

Implement to spew end of running report

Reimplemented from JobCModule.

Definition at line 113 of file EvtKinNuModule.cxx.

References Msg::kDebug, and MSG.

00114 {
00115     MSG("EvtKin",Msg::kDebug) << " EvtKinNuModule Report" << endl;
00116 }


Member Data Documentation

Definition at line 49 of file EvtKinNuModule.h.

Referenced by Config(), and GetNextVldContext().

Definition at line 63 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Definition at line 62 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Definition at line 60 of file EvtKinNuModule.h.

Referenced by BeginJob(), and Get().

UShort_t EvtKinNuModule::fRun [private]

Definition at line 51 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

UShort_t EvtKinNuModule::fRunType [private]

Definition at line 53 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Int_t EvtKinNuModule::fSnarl [private]

Definition at line 57 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Int_t EvtKinNuModule::fSpillType [private]

Definition at line 55 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Definition at line 64 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

UShort_t EvtKinNuModule::fSubRun [private]

Definition at line 52 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

Int_t EvtKinNuModule::fTimeFrame [private]

Definition at line 58 of file EvtKinNuModule.h.

Referenced by Config(), and Get().

UInt_t EvtKinNuModule::fTrigSrc [private]

Definition at line 54 of file EvtKinNuModule.h.

Referenced by Config(), and Get().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1