Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/Framework/Algorithm/AlgConfigPool.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ bool AlgConfigPool::LoadRegistries(
string key_prefix, string file_name, string root)
{
// Loads all the configuration registries from the input XML file

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgConfigPool", pDEBUG) << "[-] Loading registries:";

#endif
bool is_accessible = ! (gSystem->AccessPathName(file_name.c_str()));
if (!is_accessible) {
SLOG("AlgConfigPool", pERROR)
Expand Down Expand Up @@ -390,8 +390,9 @@ bool AlgConfigPool::LoadRegistries(

pair<string, Registry *> single_reg(key.str(), config);
fRegistryPool.insert(single_reg);

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgConfigPool", pDEBUG) << " |---o " << key.str();
#endif
}
xml_cur = xml_cur->next;
}
Expand All @@ -411,11 +412,11 @@ int AlgConfigPool::AddParameterVector (Registry * r, string pt, string pn, str
// The name scheme starts from the name and it goes like
// 'N'+pn+'s' that will be an integer with the number of entries.
// Each entry will be named pn+"-i" where i is replaced by the number

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgConfigPool", pDEBUG)
<< "Adding Parameter Vector [" << pt << "]: Key = "
<< pn << " -> Value = " << pv;

#endif
vector<string> bits = utils::str::Split( pv, delim ) ;

string n_name = Algorithm::BuildParamVectSizeKey( pn ) ;
Expand Down Expand Up @@ -454,10 +455,11 @@ int AlgConfigPool::AddParameterMatrix (Registry * r, string pt, string pn, str
LOG("AlgConfigPool", pFATAL) << "row and column have wrong delims: " << rowdelim << " " << coldelim ;
exit(1);
}
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgConfigPool", pDEBUG)
<< "Adding Parameter Matrix [" << pt << "]: Key = "
<< pn << " -> Value = " << pv;

#endif
vector<string> mat_row = utils::str::Split( pv, rowdelim ) ;

string r_name = Algorithm::BuildParamMatRowSizeKey( pn ) ;
Expand Down Expand Up @@ -563,11 +565,11 @@ void AlgConfigPool::AddConfigParameter( Registry * r,
{
// Adds a configuration parameter with type = ptype, key = pname and value =
// pvalue at the input configuration registry r

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgConfigPool", pDEBUG)
<< "Adding Parameter [" << ptype << "]: Key = "
<< pname << " -> Value = " << pvalue;

#endif
bool isRootObjParam = (strcmp(ptype.c_str(), "h1f") == 0) ||
(strcmp(ptype.c_str(), "Th2f") == 0) ||
(strcmp(ptype.c_str(), "tree") == 0);
Expand Down Expand Up @@ -718,14 +720,17 @@ Registry* AlgConfigPool::FindRegistry(string alg_name, string param_set) const
//____________________________________________________________________________
Registry * AlgConfigPool::FindRegistry(string key) const
{
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgConfigPool", pDEBUG) << "Searching for registry with key " << key;

#endif
if( fRegistryPool.count(key) == 1 ) {
map<string, Registry *>::const_iterator config_entry =
fRegistryPool.find(key);
return config_entry->second;
} else {
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgConfigPool", pDEBUG) << "No config registry for key " << key;
#endif
return 0;
}
return 0;
Expand Down
15 changes: 10 additions & 5 deletions src/Framework/Algorithm/AlgFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,17 @@ const Algorithm * AlgFactory::GetAlgorithm(const AlgId & algid)
const Algorithm * AlgFactory::GetAlgorithm(string name, string config)
{
string key = name + "/" + config;

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("AlgFactory", pDEBUG)
<< "Algorithm: " << key << " requested from AlgFactory";

#endif
map<string, Algorithm *>::const_iterator alg_iter = fAlgPool.find(key);
bool found = (alg_iter != fAlgPool.end());

if(found) {
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgFactory", pDEBUG) << key << " algorithm found in memory";
#endif
return alg_iter->second;
} else {
//-- instantiate the factory
Expand Down Expand Up @@ -155,8 +157,9 @@ Algorithm * AlgFactory::InstantiateAlgorithm(string name, string config) const
//! The class of any object instantiated here must have a LinkDef entry.

// Get object through ROOT's TROOT::GetClass() mechanism
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgFactory", pDEBUG) << "Instantiating algorithm = " << name;

#endif
TClass * tclass = gROOT->GetClass(name.c_str());
if(!tclass) {
LOG("AlgFactory", pERROR)
Expand All @@ -167,12 +170,14 @@ Algorithm * AlgFactory::InstantiateAlgorithm(string name, string config) const
Algorithm * alg_base = (Algorithm *) (vd_base);

// Configure the instantiated algorithm

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgFactory", pDEBUG) << "Setting Configuration Set = " << config;

#endif
bool skip_conf = (config=="NoConfig" || config=="");
if ( skip_conf ) {
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("AlgFactory", pDEBUG) << "Skipping algorithm configuration step!";
#endif
} else {
alg_base->Configure(config);
}
Expand Down
19 changes: 16 additions & 3 deletions src/Framework/Algorithm/Algorithm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ void Algorithm::FindConfig(void)
if ( config ) {
if ( config -> NEntries() > 0 ) {
AddTopRegistry( config, false ) ;
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "\n" << *config;
#endif
}
}
}
Expand All @@ -160,7 +162,9 @@ void Algorithm::FindConfig(void)
else {
if ( config -> NEntries() > 0 ) {
AddTopRegistry( config, false ) ;
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "\n" << config;
#endif
}
}

Expand Down Expand Up @@ -209,9 +213,11 @@ void Algorithm::FindConfig(void)
}
else {
AddLowRegistry( config, false ) ;
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "Loading "
<< it -> first << " registry "
<< list[i] << " \n" << config;
#endif
}

}
Expand All @@ -225,7 +231,9 @@ void Algorithm::FindConfig(void)
if ( config ) {
if ( config -> NEntries() > 0 ) {
AddTopRegistry( config, false ) ;
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "Loading Tunable registry \n" << config;
#endif
}
}
else {
Expand Down Expand Up @@ -261,8 +269,9 @@ const Registry & Algorithm::GetConfig(void) const {
iter != fOwnedSubAlgMp -> end() ; ++iter ) {

Algorithm * subalg = iter -> second ;

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "Appending config from " << iter -> first << " -> " << subalg -> Id() ;
#endif
const Registry & r = subalg->GetConfig();
RgKey prefix = iter -> first + "/";
fConfig -> Append(r,prefix);
Expand Down Expand Up @@ -435,16 +444,20 @@ void Algorithm::AdoptSubstructure(void)
RegistryItemI * ri = iter->second;

if(ri->TypeInfo() == kRgAlg) {
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG)
#endif
<< "Found sub-algorithm pointed to by " << reg_key;
RgAlg reg_alg = fConfig->GetAlg(reg_key);
AlgId id(reg_alg);

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "Adopting sub-algorithm = " << id.Key();
#endif
Algorithm * subalg = algf->AdoptAlgorithm(id.Name(),id.Config());
subalg->AdoptSubstructure();

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("Algorithm", pDEBUG) << "Adding sub-algorithm to local pool";
#endif
AlgMapPair key_alg_pair(reg_key, subalg);
fOwnedSubAlgMp->insert(key_alg_pair);

Expand Down
10 changes: 6 additions & 4 deletions src/Framework/EventGen/EventGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -247,26 +247,28 @@ void EventGenerator::Init(void)
i++;
}
}
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("EventGenerator", pDEBUG)
<< "Initializing unphysical event mask (" << GHepFlags::NFlags()
<< "->0) = " << *fFiltUnphysMask;
#endif
}
//___________________________________________________________________________
void EventGenerator::LoadConfig(void)
{
if(fEVGModuleVec) delete fEVGModuleVec;
if(fEVGTime) delete fEVGTime;
if(fVldContext) delete fVldContext;

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("EventGenerator", pDEBUG) << "Loading the generator validity context";

#endif
string encoded_vld_context ;
GetParam("VldContext", encoded_vld_context ) ;
fVldContext = new GVldContext;
fVldContext->Decode( encoded_vld_context );

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("EventGenerator", pDEBUG) << "Loading the event generation modules";

#endif
int nsteps ;
GetParam("NModules", nsteps) ;
if(nsteps == 0) {
Expand Down
22 changes: 16 additions & 6 deletions src/Framework/EventGen/GEVGDriver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ void GEVGDriver::BuildInteractionGeneratorMap(void)
fIntGenMap->BuildMap(*fInitState);

string mesgh = "Interaction -> Generator assignments for Initial State: ";

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("GEVGDriver", pDEBUG)
<< utils::print::PrintFramedMesg(mesgh + fInitState->AsString(), 0, '-')
<< *fIntGenMap;
#endif
}
//___________________________________________________________________________
void GEVGDriver::BuildInteractionSelector(void)
Expand Down Expand Up @@ -245,9 +246,10 @@ EventRecord * GEVGDriver::GenerateEvent(const TLorentzVector & nu4p)
<< init_state.AsString() << " at E = " << nu4p.E() << " GeV";
return 0;
}

#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
//-- Get a ptr to the interaction summary
LOG("GEVGDriver", pDEBUG) << "Getting the selected interaction";
#endif
Interaction * interaction = fCurrentRecord->Summary();

//-- Find the appropriate concrete EventGeneratorI implementation
Expand Down Expand Up @@ -375,8 +377,9 @@ double GEVGDriver::XSecSum(const TLorentzVector & nup4)
// Computes the sum of the cross sections for all the interactions that can
// be simulated for the given initial state and for the input neutrino energy
//
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("GEVGDriver", pDEBUG) << "Computing the cross section sum";

#endif
double xsec_sum = 0;

// Get the list of spline objects
Expand All @@ -395,9 +398,10 @@ double GEVGDriver::XSecSum(const TLorentzVector & nup4)
interaction->InitStatePtr()->SetProbeP4(nup4);

string code = interaction->AsString();
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("GEVGDriver", pDEBUG)
<< "Compute cross section for interaction: \n" << code;

#endif
// get corresponding cross section algorithm
const XSecAlgorithmI * xsec_alg =
fIntGenMap->FindGenerator(interaction)->CrossSectionAlg();
Expand All @@ -416,12 +420,13 @@ double GEVGDriver::XSecSum(const TLorentzVector & nup4)

// sum-up and report
xsec_sum += xsec;
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("GEVGDriver", pDEBUG)
<< "\nInteraction = " << code
<< "\nCross Section "
<< (fUseSplines ? "*interpolated*" : "*computed*")
<< " = " << (xsec/units::cm2) << " cm2";

#endif
delete interaction;
} // loop over event generators

Expand Down Expand Up @@ -654,13 +659,18 @@ void GEVGDriver::CreateSplines(int nknots, double emax, bool useLogE)
// only create the spline if it does not already exists
bool spl_exists = xsl->SplineExists(alg, interaction);
if(!spl_exists) {
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("GEVGDriver", pDEBUG)
<< "The spline wasn't loaded at initialization. "
<< "I can build it now but it might take a while...";
#endif
xsl->CreateSpline(alg, interaction) ;
} else {
}
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
else {
SLOG("GEVGDriver", pDEBUG) << "Spline was found";
}
#endif
} // loop over interaction that can be generated by this generator
delete ilst;
ilst = 0;
Expand Down
Loading