22 sprintf(
s,
"^(%i)",
Kmap.second);
37 int iu = log2(
range() / u);
41 "analyzing %s: range %g is much larger then %g. suggest cutting by a factor of 2^%i",
51 double eff = h_->Integral() / h_->GetEntries();
53 sprintf(slog,
"analyzing %s: range is too small, contains %f",
name_.c_str(), eff);
58 TCanvas *
c =
new TCanvas();
64 sprintf(slog,
"analyzing %s: no histogram!\n",
name_.c_str());
83 "Name = %s \t Op = %s \t nbits = %i \n ival = %li \t fval = %g \t K = %g Range = %f\n units = %s\n",
100 "Name = %s \t Op = %s \t nbits = %i \n ival = %li \t fval = %g \t K = %g Range = %f\n units = " 101 "%s\n step = %i, latency = %i\n",
127 double r = Knew /
K_;
201 "(.clk(clk), .val_in(" +
name +
"), .val_out(" + name_delayed +
"));\n";
221 if (globals->h_file_ == 0) {
222 globals->h_file_ =
new TFile(
"imath.root",
"RECREATE");
225 globals->h_file_->cd();
226 TTree *
tt = (TTree *)globals->h_file_->Get(
"tt");
228 tt =
new TTree(
"tt",
"");
240 if (!
tt->GetBranchStatus(si.c_str())) {
241 tt->Branch(si.c_str(), (Long64_t *)&(
v->ival_));
242 tt->Branch(sf.c_str(), &(
v->fval_));
243 tt->Branch(
sv.c_str(), &(
v->val_));
247 addToTree(globals,
v->p1_,
s);
249 addToTree(globals,
v->p2_,
s);
251 addToTree(globals,
v->p3_,
s);
255 TTree *VarBase::addToTree(
imathGlobals *globals,
double *
v,
char *
s) {
256 if (globals->h_file_ == 0) {
257 globals->h_file_ =
new TFile(
"imath.root",
"RECREATE");
260 globals->h_file_->cd();
261 TTree *
tt = (TTree *)globals->h_file_->Get(
"tt");
263 tt =
new TTree(
"tt",
"");
269 TTree *VarBase::addToTree(
imathGlobals *globals,
int *
v,
char *
s) {
270 if (globals->h_file_ == 0) {
271 globals->h_file_ =
new TFile(
"imath.root",
"RECREATE");
274 globals->h_file_->cd();
275 TTree *
tt = (TTree *)globals->h_file_->Get(
"tt");
277 tt =
new TTree(
"tt",
"");
284 if (globals->h_file_ == 0)
286 globals->h_file_->cd();
287 TTree *
tt = (TTree *)globals->h_file_->Get(
"tt");
293 if (globals->h_file_ == 0)
295 globals->h_file_->cd();
296 TTree *
tt = (TTree *)globals->h_file_->Get(
"tt");
305 const std::map<
const VarBase *, std::vector<bool> > *
const previous_passes)
const {
308 if (!previous_passes || (previous_passes && !previous_passes->count(
cut_var_))) {
324 << ((
ival_ > lower_cut &&
ival_ < upper_cut) ?
"PASSES" :
"FAILS")
325 <<
" (required: " << lower_cut *
K_ <<
" < " <<
ival_ *
K_ <<
" < " << upper_cut *
K_ 333 const std::map<
const VarBase *, std::vector<bool> > *
const previous_passes)
const {
345 if (!previous_passes || (previous_passes && !previous_passes->count(
this))) {
351 << ((
ival_ > lower_cut &&
ival_ < upper_cut) ?
"PASSES" :
"FAILS")
352 <<
" (required: " << lower_cut *
K_ <<
" < " <<
ival_ *
K_ <<
" < " 353 << upper_cut *
K_ <<
")";
361 if (call_set_cut_var)
362 cut->set_cut_var(
this,
false);
375 if (
cut->op() ==
"cut" && call_set_parent_flag) {
400 std::map<const VarBase *, std::vector<bool> > passes0, passes1;
402 if (
cut->op() !=
"cut")
408 if (
cut->op() !=
"cut")
409 cut->passes(passes1, &passes0);
411 if (
cut->cut_var()->p1())
412 cut->cut_var()->p1()->passes(passes1, &passes0);
413 if (
cut->cut_var()->p2())
414 cut->cut_var()->p2()->passes(passes1, &passes0);
415 if (
cut->cut_var()->p3())
416 cut->cut_var()->p3()->passes(passes1, &passes0);
421 for (
const auto &
cut_var : passes0) {
423 for (
const auto pass :
cut_var.second)
427 for (
const auto &
cut_var : passes1) {
429 for (
const auto pass :
cut_var.second)
void set_cut_var(VarBase *cut_var, const bool call_add_cut=true)
Log< level::Info, true > LogVerbatim
void inputs(std::vector< VarBase *> *vd)
void add_cut(VarCut *cut, const bool call_set_cut_var=true)
std::string pipe_delays(const int step)
std::string kstring() const
std::vector< int > pipe_delays_
static std::string to_string(const XMLCh *ch)
void passes(std::map< const VarBase *, std::vector< bool > > &passes, const std::map< const VarBase *, std::vector< bool > > *const previous_passes=nullptr) const
int addr_to_ival(int addr)
void initLUT(double offset)
bool local_passes() const
std::map< std::string, int > Kmap() const
Abs< T >::type abs(const T &t)
static std::string itos(int i)
void adjust(double Knew, double epsilon=1e-5, bool do_assert=false, int nbits=-1)
std::vector< DeviationSensor2D * > vd
void set_parent_flag(VarFlag *parent_flag, const bool call_add_cut)
void add_cut(VarBase *cut, const bool call_set_parent_flag=true)
static std::string pipe_delay_wire(VarBase *v, std::string name_delayed, int nbits, int delay)
std::vector< VarBase * > cuts_
static std::string pipe_delay(VarBase *v, int nbits, int delay)
std::map< std::string, int > Kmap_
void local_passes(std::map< const VarBase *, std::vector< bool > > &passes, const std::map< const VarBase *, std::vector< bool > > *const previous_passes=nullptr) const
std::vector< unsigned short int > LUT