223 static void PlaneXY(
const Double_t *total, Int_t reac, Double_t &x,
229 static Int_t
YLoOf(Int_t reac);
232 static Int_t
YHiOf(Int_t reac);
256 static Double_t
JumpMin(Int_t reac);
260 static Double_t s_jumpSigma[18];
261 static Double_t s_stripSigma[18];
262 std::map<Int_t, TH2F *> m_scatter;
263 std::vector<TraceEvt> m_reservoir;
268 std::vector<Long64_t> m_normedAt;
269 std::vector<Long64_t> m_tagged;
273 const TString kSimCacheName =
"StripSumScatter_simcache.root";
275 static Int_t ReacIndex(Int_t reac);
277 Bool_t TryLoadCache(
const TString &cacheName,
const TString &fingerprint);
278 void WriteCache(
const TString &cacheName,
const TString &fingerprint);
281 void AllocateScatters();
285 void ReprojectFromReservoir();
286 void FillScatters(
const std::vector<Int_t> &runOrder,
287 std::map<Int_t, TChain *> &chains);
296 void PlotParityRejectedGrid(
const std::vector<Int_t> &run_order,
297 std::map<Int_t, TChain *> &chains);
299 void InteractiveOverlay(Int_t reac);
301 static void EnableEventBranches(TChain *chain);
302 static Bool_t AllStripsFired(
const EnergyView &ev);
307 static Bool_t MeasureBeamNoise(TChain *chain, Double_t *jump_sigma,
308 Double_t *strip_sigma);
311 static Bool_t BeamUpstreamOf(
const EnergyView &ev, Int_t reac);
314 static Bool_t IsOffbeam(
const EnergyView &ev);
315 static Bool_t IsParityAsymmetric(
const EnergyView &ev);
316 static Double_t SumRange(
const Double_t *total, Int_t lo, Int_t hi);
317 static std::vector<GateSpec> ActiveGates();
322 static BeamFit2D FindBeamGate(TChain *chain, Int_t sx, Int_t sy,
323 const std::vector<GateSpec> &prior_specs,
324 const std::vector<BeamFit2D> &prior_gates,
325 const TString &tag,
const TString &subdir);
327 static void DrawTraceSet(
const std::vector<TGraph *> &traces, Int_t color);
328 void DrawAltDecodeRegionTraces(Int_t reac, TCutG *cutAn, TCutG *cutAa);
329 static TGraph *TraceFromTotal(
const Float_t *total);
330 static void DrawRegionTraces(
const TString &save_name,
const TString &subdir,
331 const std::vector<TGraph *> &beam,
332 const std::vector<TGraph *> &aa,
333 const std::vector<TGraph *> &an, Double_t y_min,
334 Double_t y_max,
const char *y_title);
336 static void DrawRegionMeanTraces(
const TString &save_name,
337 const TString &subdir,
338 const std::vector<TGraph *> &beam,
339 const std::vector<TGraph *> &aa,
340 const std::vector<TGraph *> &an,
341 Double_t y_min, Double_t y_max,
342 const char *y_title);
344 static void TraceYRange(
const std::vector<TGraph *> &beam,
345 const std::vector<TGraph *> &aa,
346 const std::vector<TGraph *> &an, Double_t &y_min,
349 FitRunGates(Int_t run, TChain *chain,
350 const std::vector<GateSpec> &activeGates);
352 Int_t run, TChain *chain,
const std::vector<GateSpec> &activeGates,
353 const std::vector<BeamFit2D> &runGates,
const BeamEllipses &runBeam);
354 static TCutG *PromptCut(TCanvas *c,
const char *name,
const char *label);
355 static void SaveRegionCuts(Int_t reac, TCutG *cut_an, TCutG *cut_aa);
356 static TCutG *LoadRegionCut(
const char *name, Int_t reac);
358 static void SmoothTrace(
const Double_t *in, Double_t *out, Int_t width);
363 static void SavitzkyGolay(
const Double_t *in, Double_t *out);
368 static Int_t FindTrigger(
const Double_t *td,
const Double_t *base,
369 Double_t beam_sigma);
373 static TGraph *SmoothedTraceFromTotal(
const Float_t *total);
375 void ClusterVarHists(Int_t reac, TCutG *cut_aa, TCutG *cut_an,
376 const TString &subdir);
379 SimFingerprint(
const std::vector<RemixSim::SimFileSpec> &specs);
380 static TString BuildFingerprint(
const std::vector<Int_t> &run_order,
381 std::map<Int_t, TChain *> &chains);
382 static void YBounds(Double_t *y_lo, Double_t *y_hi);
383 static TString PrettyLabel(
const TString &tag);
400 static Bool_t SimBeamGains(Double_t *gain);
401 static void SimTotal(
const Float_t *left,
const Float_t *right,
402 const Double_t *gain, Double_t *total);
403 static TGraph *SimPopScatter(
const TString &file, Int_t reac,
404 const Double_t *gain, Long64_t max_points);
405 static std::vector<TGraph *>
406 SimPopTraces(
const TString &file,
const Double_t *gain, Long64_t max_traces);
407 void SimTraceOverlay();
408 static Bool_t LoadSimCache(
const TString &fp,
409 std::map<Int_t, std::vector<TGraph *>> &by_strip);
411 WriteSimCache(
const TString &fp,
412 const std::map<Int_t, std::vector<TGraph *>> &by_strip);