4 for (Int_t k = 0; k < 16; k++) {
11 if (!t->GetBranch(
"LeftdE") || !t->GetBranch(
"Strip0dE")) {
12 std::cerr <<
"RemixSim: events_MeV tree has no LeftdE/Strip0dE branches; "
13 "it predates the per-end layout and must be re-simulated"
17 t->SetBranchAddress(
"LeftdE",
left);
18 t->SetBranchAddress(
"RightdE",
right);
19 t->SetBranchAddress(
"Strip0dE", &
strip0);
20 t->SetBranchAddress(
"Strip17dE", &
strip17);
33 if (s == 0 || s == 17)
38Bool_t RemixSim::SimFileSpecTagLess(
const SimFileSpec &a,
40 return a.
tag.CompareTo(b.
tag) < 0;
46 std::ifstream in(filepath.Data());
51 while (std::getline(in, raw)) {
52 TString line(raw.c_str());
53 line = line.Strip(TString::kLeading);
54 if (!line.BeginsWith(
"output"))
56 Ssiz_t start = line.Index(prefix);
59 TString rest = line(start, line.Length() - start);
60 Ssiz_t dot = rest.Index(
".root");
63 TString base = rest(0, dot);
64 base.Remove(0, prefix.Length());
71 std::vector<SimFileSpec> specs;
73 void *d = gSystem->OpenDirectory(dir.Data());
75 std::cerr <<
"BuildFileSpecs: cannot open control dir " << dir << std::endl;
79 while ((entry = gSystem->GetDirEntry(d))) {
81 if (!name.EndsWith(
".toml"))
84 if (tag.Length() > 0) {
90 gSystem->FreeDirectory(d);
91 std::sort(specs.begin(), specs.end(), SimFileSpecTagLess);
94 for (Int_t i = 1; i < Int_t(specs.size()); i++) {
99 std::cerr <<
"RemixSim: two control files in " << dir
100 <<
" simulate the same reaction at the same strip: "
101 << specs[i - 1].tag <<
" and " << specs[i].tag <<
"; keep one"
118 Ssiz_t pos = tag.Last(
'_');
121 TString last = tag(pos + 1, tag.Length() - pos - 1);
122 if (last.Length() < 2 || last[0] !=
's')
124 TString digits = last(1, last.Length() - 1);
125 if (!digits.IsDigit())
127 return digits.Atoi();
133 Ssiz_t pos = tag.Last(
'_');
static TString DatasetName()
The dataset's isotope name, e.g.
static TString DatasetDir()
Absolute path to the active dataset directory, analysis/<iso>.
static TString TagFromControlFile(const TString &filepath)
Extract the simulation tag from a control file.
static TString TracesName(const SimFileSpec &s)
On-disk basename, traces_<iso>_<tag>, with no directory or extension.
static TString ControlDir()
Absolute path to the control directory, <dataset>/sim_control.
static TString SimRootPath(const SimFileSpec &s)
Absolute path to a simulation's ROOT file.
static Int_t ReactionStripOf(const TString &tag)
Which strip a simulated reaction occurs on.
static TString TagWithoutStrip(const TString &tag)
The tag with any trailing _s<N> reaction-strip token removed.
static std::vector< SimFileSpec > BuildFileSpecs()
Every simulation this dataset defines.
Double_t Left(Int_t s) const
Left end of strip s (1-16), or the whole of strip 0 or 17.
Float_t left[16]
Left end of strips 1-16, index strip - 1.
Float_t strip17
Strip 17, unsegmented.
Float_t right[16]
Right end of strips 1-16, index strip - 1.
Bool_t Attach(TTree *t)
Bind to an events_MeV tree and set up the branch addresses.
Float_t strip0
Strip 0, unsegmented.
Double_t Right(Int_t s) const
Right end of strip s (1-16); zero for strips 0 and 17.
One simulated dataset, identified by its tag.
TString tag
Simulation tag, from the control file's output line.