Classes | Functions
simple_FC_validation.C File Reference
#include "TFile.h"
#include "TTree.h"
#include <iostream>

Go to the source code of this file.

Classes

struct  FC
 

Functions

bool operator== (FC &A, FC &B)
 
void fill_exps (TString file, std::map< double, FC > &exps)
 
void simple_FC_validation (TString fileA, TString fileB, double tolerance=0)
 

Function Documentation

void fill_exps ( TString  file,
std::map< double, FC > &  exps 
)

Definition at line 14 of file simple_FC_validation.C.

References FC::bestchi, MakeMiniprodValidationCuts::f, make_pair(), seed, and FC::truechi.

Referenced by simple_FC_validation().

14  {
15 
16  TFile *f = TFile::Open(file);
17  TTree *fcTree = (TTree*)f->Get("fc");
18 
19  double truechi = -1;
20  double bestchi = -1;
21  double seed = -1;
22 
23  fcTree->SetBranchStatus("*",0);
24  fcTree->SetBranchStatus("truechi",1);
25  fcTree->SetBranchStatus("bestchi",1);
26  fcTree->SetBranchStatus("loadtime",1);
27 
28  fcTree->SetBranchAddress("truechi",&truechi);
29  fcTree->SetBranchAddress("bestchi",&bestchi);
30  fcTree->SetBranchAddress("loadtime",&seed);
31 
32  Int_t numberOfEntries = fcTree->GetEntriesFast();
33  for (Int_t event = 0; event < numberOfEntries; ++event)
34  {
35  fcTree->GetEntry(event);
36  FC tmp_fc = {truechi,bestchi};
37  exps.insert(std::make_pair(seed,
38  tmp_fc));
39  }
40  f->Close();
41 }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
unsigned int seed
Definition: runWimpSim.h:102
TFile * file
Definition: cellShifts.C:17
bool operator== ( FC A,
FC B 
)
void simple_FC_validation ( TString  fileA,
TString  fileB,
double  tolerance = 0 
)

Definition at line 43 of file simple_FC_validation.C.

References om::cout, allTimeWatchdog::endl, fill_exps(), it, and seed.

43  {
44 
45  std::cout << "Comparing FCs :" << std::endl;
46 
47  std::map<double, FC> FC_A;
48  std::map<double, FC> FC_B;
49 
50  fill_exps(fileA, FC_A);
51  fill_exps(fileB, FC_B);
52 
53  for(auto & it : FC_A) {
54  double seed = it.first;
55  if(it.second==FC_B.at(seed))
56  std::cout << "Validated!" << std::endl;
57  else
58  std::cout << "Not validated!" << std::endl;
59  }
60 
61 }
set< int >::iterator it
unsigned int seed
Definition: runWimpSim.h:102
OStream cout
Definition: OStream.cxx:6
void fill_exps(TString file, std::map< double, FC > &exps)