8 #include "TSeqCollection.h"
27 TSeqCollection* seq = gROOT->GetListOfFiles();
28 for(
int i = 0; i < seq->GetEntries(); ++i){
29 TFile* f = (TFile*)seq->At(i);
30 if(f->GetOption() != std::string(
"READ"))
continue;
31 TTree* tr = (TTree*)f->Get(
"globalTree");
33 if(tr->GetEntries() < 1)
continue;
36 std::cout <<
"\nUniverseOracle: Found globalTree in multiple places. Will use first one, but this is unexpected" << std::endl;
40 tr->SetBranchAddress(
"global", &pglobal);
46 std::cout <<
"\nUniverseOracle: Failed to find globalTree in any open input file" << std::endl;
56 std::cout << global.
wgts.size() <<
" parameter sets:" << std::endl;
57 for(
unsigned int i = 0; i < global.
wgts.size(); ++i){
59 std::cout <<
" " << i <<
": " << pset.
name <<
", type " << pset.
type <<
", " << pset.
nuniv <<
" universes, adjusted parameters:" << std::endl;
78 std::cout <<
"\nSystematic weights in file:" << std::endl;
81 for(
unsigned int i = 0; i < global.
wgts.size(); ++i){
89 if(pset.
map.size() != 1)
continue;
107 std::vector<std::string> ret;
109 for(
auto it:
fShiftVals) ret.push_back(it.first);
125 std::cout <<
"UniverseOracle: pset '" << name <<
"' not known" << std::endl;
136 std::cout <<
"UniverseOracle: syst '" << name <<
"' not known" << std::endl;
146 double* trueShift)
const
151 for(
unsigned int i = 0; i < v.size(); ++i){
154 const double dv = fabs(v[i]-shift);
155 if(bestIdx == -1 || dv < bestDist){
158 if(trueShift) *trueShift = v[i];
161 return unsigned(bestIdx);
unsigned int SystIndex(const std::string &name) const
Which index in the weights array corresponds to the shifting of just this syst (in any parameter set)...
caf::SRGlobal GetSRGlobal()
std::map< std::string, unsigned int > fSystIdxs
const std::vector< float > & ShiftsForSyst(const std::string &name) const
List of shifts for this syst in each universe.
ESide
Desired match type in UniverseOracle::ClosestShiftIndex.
process_name opflashCryoW ana
std::vector< SRWeightPSet > wgts
static UniverseOracle & Instance()
void PrintSRGlobal(const caf::SRGlobal &global)
std::vector< SRWeightMapEntry > map
std::map< std::string, std::vector< float > > fShiftVals
std::vector< std::string > Systs() const
List of all known syst names.
std::map< std::string, unsigned int > fPSetIdxs
unsigned int ParameterSetIndex(const std::string &name) const
Which index in the weights array corresponds to this parameter set?
unsigned int ClosestShiftIndex(const std::string &name, double shift, ESide side=ESide::kEither, double *trueShift=0) const
Within that entry, which index corresponds most closely to 'shift'?
bool SystExists(const std::string &name) const
BEGIN_PROLOG could also be cout