86#include "TRestAnalysisTree.h"
93#include "TRestStringHelper.h"
94#include "TRestStringOutput.h"
100TRestAnalysisTree::TRestAnalysisTree() : TTree() {
101 SetName(
"AnalysisTree");
102 SetTitle(
"REST Analysis tree");
107TRestAnalysisTree::TRestAnalysisTree(TTree* tree) : TTree() {
108 SetName(
"AnalysisTree");
109 SetTitle(
"Linked to " + (TString)tree->GetName());
115 TObjArray* lfs = tree->GetListOfLeaves();
116 for (
int i = 0; i < lfs->GetLast() + 1; i++) {
117 TLeaf* lf = (TLeaf*)lfs->UncheckedAt(i);
119 ReadLeafValueToObservable(lf, obs);
120 obs.
name = lf->GetName();
121 SetObservable(-1, obs);
126 if (tree->ClassName() == (TString)
"TRestAnalysisTree") {
133TRestAnalysisTree::TRestAnalysisTree(
const TString& name,
const TString& title) : TTree(name, title) {
140void TRestAnalysisTree::Initialize() {
145 fSubEventTag =
new TString();
152 fObservableIdMap.clear();
153 fObservableIdSearchMap.clear();
154 fObservableDescriptions.clear();
155 fObservableNames.clear();
156 fObservables.clear();
167 auto iter = fObservableIdMap.find(obsName);
168 if (iter != fObservableIdMap.end()) {
183 auto iter = fObservableIdSearchMap.find(obsName);
184 if (iter != fObservableIdSearchMap.end()) {
188 for (
auto& fObservableName : fObservableNames) {
189 string obs = (string)fObservableName;
192 obs = obs.substr(obs.find(
'_') + 1, -1);
195 diffs.push_back(min(diff1, diff2));
198 int matchedCount = 0;
201 for (
unsigned int i = 0; i < diffs.size(); i++) {
202 if (min > diffs[i]) {
211 if (matchedCount == 1) {
212 cout <<
"TRestAnalysisTree::GetObservableID(): Find observable " << fObservableNames[minPos]
213 <<
" for obs name: " << obsName << endl;
214 fObservableIdSearchMap[obsName] = minPos;
216 }
else if (matchedCount == 0) {
217 RESTError <<
"TRestAnalysisTree::GetObservableID(): No Matching observable found" << RESTendl;
219 RESTError <<
"did you mean \"" << fObservableNames[minPos] <<
"\" ?" << RESTendl;
220 fObservableIdSearchMap[obsName] = -1;
224 RESTWarning <<
"TRestAnalysisTree::GetObservableID(): Multiple observables found" << RESTendl;
226 <<
"Please specify the full observable name (e.g, sAna_ThresholdIntegral) in your code. "
228 RESTWarning <<
"Returning the first matched observable : " << fObservableNames[minPos]
230 fObservableIdSearchMap[obsName] = minPos;
234 fObservableIdSearchMap[obsName] = -1;
245 return fObservableIdMap.count(obsName) > 0;
271 int NBranches = GetListOfBranches()->GetEntriesFast();
272 int NObsInList = fObservables.size();
273 int Entries = GetEntriesFast();
279 if (NBranches == 0) {
280 return TRestAnalysisTree_Status::Created;
284 if (NObsInList == 0) {
286 return TRestAnalysisTree_Status::Retrieved;
288 return TRestAnalysisTree_Status::EmptyCloned;
292 return TRestAnalysisTree_Status::Filled;
294 return TRestAnalysisTree_Status::Connected;
297 }
else if (NBranches == 6) {
298 auto br = (TBranch*)GetListOfBranches()->UncheckedAt(0);
299 if ((
int*)br->GetAddress() != &fRunOrigin) {
301 return TRestAnalysisTree_Status::Retrieved;
303 return TRestAnalysisTree_Status::EmptyCloned;
307 return TRestAnalysisTree_Status::Filled;
309 return TRestAnalysisTree_Status::Connected;
313 return TRestAnalysisTree_Status::Error;
316 return TRestAnalysisTree_Status::Error;
329 TBranch* br1 = GetBranch(
"runOrigin");
330 TBranch* br2 = GetBranch(
"subRunOrigin");
331 TBranch* br3 = GetBranch(
"eventID");
332 TBranch* br4 = GetBranch(
"subEventID");
333 TBranch* br5 = GetBranch(
"timeStamp");
334 TBranch* br6 = GetBranch(
"subEventTag");
336 if (br1 && br2 && br3 && br4 && br5 && br6) {
337 br1->SetAddress(&fRunOrigin);
338 br2->SetAddress(&fSubRunOrigin);
339 br3->SetAddress(&fEventID);
340 br4->SetAddress(&fSubEventID);
341 br5->SetAddress(&fTimeStamp);
342 br6->SetAddress(&fSubEventTag);
344 cout <<
"REST Error: TRestAnalysisTree::ConnectBranches(): event branches does not exist!" << endl;
349 fObservables = std::vector<RESTValue>(GetNumberOfObservables());
350 for (
int i = 0; i < GetNumberOfObservables(); i++) {
352 fObservables[i].name = fObservableNames[i];
362 for (
int i = 0; i < GetNumberOfObservables(); i++) {
363 TBranch* branch = GetBranch(fObservableNames[i]);
364 if (branch !=
nullptr) {
365 if (branch->GetAddress() !=
nullptr) {
366 if ((
string)branch->ClassName() !=
"TBranch") {
368 fObservables[i].address = *(
char**)branch->GetAddress();
371 fObservables[i].address = branch->GetAddress();
374 fObservables[i].Assembly();
375 branch->SetAddress(fObservables[i].address);
392 if (!GetBranch(
"runOrigin")) Branch(
"runOrigin", &fRunOrigin);
393 if (!GetBranch(
"subRunOrigin")) Branch(
"subRunOrigin", &fSubRunOrigin);
394 if (!GetBranch(
"eventID")) Branch(
"eventID", &fEventID);
395 if (!GetBranch(
"subEventID")) Branch(
"subEventID", &fSubEventID);
396 if (!GetBranch(
"timeStamp")) Branch(
"timeStamp", &fTimeStamp);
397 if (!GetBranch(
"subEventTag")) Branch(
"subEventTag", fSubEventTag);
399 for (
int n = 0; n < GetNumberOfObservables(); n++) {
400 TString typeName = fObservableTypes[n];
401 TString brName = fObservableNames[n];
402 char* ref = fObservables[n].address;
404 TBranch* branch = GetBranch(brName);
405 if (branch ==
nullptr) {
406 if (typeName ==
"double") {
407 this->Branch(brName, (
double*)ref);
408 }
else if (typeName ==
"float") {
409 this->Branch(brName, (
float*)ref);
410 }
else if (typeName ==
"long double") {
411 this->Branch(brName, (
long double*)ref);
412 }
else if (typeName ==
"bool") {
413 this->Branch(brName, (
bool*)ref);
414 }
else if (typeName ==
"char") {
415 this->Branch(brName, (
char*)ref);
416 }
else if (typeName ==
"int") {
417 this->Branch(brName, (
int*)ref);
418 }
else if (typeName ==
"short") {
419 this->Branch(brName, (
short*)ref);
420 }
else if (typeName ==
"unsigned char") {
421 this->Branch(brName, (
unsigned char*)ref);
422 }
else if (typeName ==
"unsigned int") {
423 this->Branch(brName, (
unsigned int*)ref);
424 }
else if (typeName ==
"unsigned short") {
425 this->Branch(brName, (
unsigned short*)ref);
426 }
else if (typeName ==
"long") {
427 this->Branch(brName, (
long*)ref);
428 }
else if (typeName ==
"long long") {
429 this->Branch(brName, (
long long*)ref);
430 }
else if (typeName ==
"unsigned long") {
431 this->Branch(brName, (
unsigned long*)ref);
432 }
else if (typeName ==
"unsigned long long") {
433 this->Branch(brName, (
unsigned long long*)ref);
435 this->Branch(brName, typeName, ref);
438 this->GetBranch(brName)->SetTitle(
"(" + typeName +
") " + fObservableDescriptions[n]);
445void TRestAnalysisTree::InitObservables() {
446 fObservables = std::vector<RESTValue>(GetNumberOfObservables());
447 for (
int i = 0; i < GetNumberOfObservables(); i++) {
449 fObservables[i].name = fObservableNames[i];
460 if (fObservableIdMap.size() != fObservableNames.size()) {
461 fObservableIdMap.clear();
462 for (
unsigned int i = 0; i < fObservableNames.size(); i++) {
463 fObservableIdMap[(string)fObservableNames[i]] = i;
465 if (fObservableIdMap.size() != fObservableNames.size()) {
466 cout <<
"REST ERROR! duplicated or blank observable name!" << endl;
471void TRestAnalysisTree::ReadLeafValueToObservable(TLeaf* lf,
RESTValue& obs) {
472 if (lf ==
nullptr || lf->GetLen() == 0)
return;
477 string leafdef(lf->GetBranch()->GetTitle());
478 if (leafdef.find(
"[") == string::npos) {
480 switch (leafdef[leafdef.size() - 1]) {
506 RESTError <<
"Unsupported leaf definition: " << leafdef <<
"! Assuming int" << RESTendl;
510 switch (leafdef[leafdef.size() - 1]) {
512 type =
"vector<int>";
515 type =
"vector<float>";
518 type =
"vector<double>";
521 RESTError <<
"Unsupported leaf definition: " << leafdef <<
"! Assuming vector<int>"
523 type =
"vector<int>";
532 obs.
address = (
char*)lf->GetValuePointer();
533 }
else if (obs.
type ==
"vector<double>") {
534 auto ptr = (
double*)lf->GetValuePointer();
535 vector<double> val(ptr, ptr + lf->GetLen());
537 }
else if (obs.
type ==
"vector<int>") {
538 int* ptr = (
int*)lf->GetValuePointer();
539 vector<int> val(ptr, ptr + lf->GetLen());
541 }
else if (obs.
type ==
"vector<float>") {
542 auto ptr = (
float*)lf->GetValuePointer();
543 vector<float> val(ptr, ptr + lf->GetLen());
545 }
else if (obs.
type ==
"string") {
546 char* ptr = (
char*)lf->GetValuePointer();
547 string val(ptr, lf->GetLen());
550 RESTWarning <<
"Unsupported observable type to convert from TLeaf!" << RESTendl;
554RESTValue TRestAnalysisTree::GetObservable(
const string& obsName) {
556 if (
id == -1)
return {};
557 return GetObservable(
id);
564 cout <<
"Error! TRestAnalysisTree::GetObservable(): index outside limits!" << endl;
572 return fObservables[n];
578 cout <<
"Error! TRestAnalysisTree::GetObservableName(): index outside limits!" << endl;
581 return fObservableNames[n];
587 cout <<
"Error! TRestAnalysisTree::GetObservableDescription(): index outside limits!" << endl;
590 return fObservableDescriptions[n];
596 cout <<
"Error! TRestAnalysisTree::GetObservableType(): index outside limits!" << endl;
599 return fObservableTypes[n];
605 if (
id == -1)
return "NotFound";
621 cout <<
"Error! TRestAnalysisTree::GetDblObservableValue(): index outside limits!" << endl;
628 cout <<
"TRestAnalysisTree::GetDblObservableValue. Type " <<
GetObservableType(n)
629 <<
" not supported! Returning zero" << endl;
633RESTValue TRestAnalysisTree::AddObservable(
const TString& observableName,
const TString& observableType,
634 const TString& description) {
639 cout <<
"REST_Warning: cannot add observable for retrieved tree with data!" << endl;
644 }
else if (fStatus == Filled) {
645 cout <<
"REST_Warning: cannot add observable! AnalysisTree is already filled" << endl;
647 }
else if (
fChain !=
nullptr) {
648 cout <<
"Error! cannot add observable! AnalysisTree is in chain state" << endl;
654 ptr.
name = observableName;
656 fObservableNames.push_back(observableName);
657 fObservableIdMap[(string)observableName] = fObservableNames.size() - 1;
658 fObservableDescriptions.push_back(description);
659 fObservableTypes.push_back(observableType);
660 fObservables.push_back(ptr);
664 cout <<
"Error adding observable \"" << observableName <<
"\" with type \"" << observableType
665 <<
"\", type not found!" << endl;
675void TRestAnalysisTree::PrintObservables() {
680 cout <<
"TRestAnalysisTree::PrintObservables(): Reading entry 0" << endl;
683 cout <<
"REST_Warning: AnalysisTree is empty" << endl;
686 cout <<
"REST_Warning: AnalysisTree is empty" << endl;
687 }
else if (fStatus == Filled) {
691 std::cout <<
"Entry : " << GetReadEntry() << std::endl;
692 std::cout <<
"> Event ID : " << GetEventID() << std::endl;
693 std::cout <<
"> Event Time : " << GetTimeStamp() << std::endl;
694 std::cout <<
"> Event Tag : " << GetSubEventTag() << std::endl;
695 std::cout <<
"-----------------------------------------" << std::endl;
698 for (
int n = 0; n < GetNumberOfObservables(); n++) {
704void TRestAnalysisTree::PrintObservable(
int n) {
708 string obsVal = GetObservable(n).
ToString();
709 int lengthRemaining = Console::GetWidth() - 14 - 45 - 13;
711 std::cout <<
"Observable : " << ToString(fObservableNames[n], 45)
712 <<
" Value : " << ToString(obsVal, lengthRemaining) << std::endl;
715Int_t TRestAnalysisTree::GetEntry(Long64_t entry, Int_t getall) {
725 }
else if (fStatus == Filled) {
729 return fChain->GetEntry(entry, getall);
731 return TTree::GetEntry(entry, getall);
737 cout <<
"Error! cannot fill tree. AnalysisTree is in chain state" << endl;
741 if (tree !=
nullptr) {
742 fEventID = tree->GetEventID();
743 fSubEventID = tree->GetSubEventID();
744 fTimeStamp = tree->GetTimeStamp();
745 *fSubEventTag = tree->GetSubEventTag();
746 fRunOrigin = tree->GetRunOrigin();
747 fSubRunOrigin = tree->GetSubRunOrigin();
751void TRestAnalysisTree::SetEventInfo(
TRestEvent* evt) {
753 cout <<
"Error! cannot fill tree. AnalysisTree is in chain state" << endl;
757 if (evt !=
nullptr) {
758 fEventID = evt->GetID();
759 fSubEventID = evt->GetSubID();
760 fTimeStamp = evt->GetTimeStamp().AsDouble();
761 *fSubEventTag = evt->GetSubEventTag();
762 fRunOrigin = evt->GetRunOrigin();
763 fSubRunOrigin = evt->GetSubRunOrigin();
767Int_t TRestAnalysisTree::Fill() {
771 cout <<
"Error! cannot fill tree. AnalysisTree is in chain state" << endl;
775 fSetObservableIndex = 0;
777 if (fStatus == Filled) {
778 return TTree::Fill();
779 }
else if (fStatus ==
Created) {
781 int a = TTree::Fill();
786 int a = TTree::Fill();
791 int a = TTree::Fill();
796 int a = TTree::Fill();
808 cout <<
"Error! cannot set observable! AnalysisTree is in chain state" << endl;
819 }
else if (
id == (
int)fObservables.size()) {
825 if (obs.
type != fObservables[
id].type) {
829 cout <<
"Warning: SetObservableValue(): setting value with different type. Observable : "
830 << obs.
name <<
", existing type: " << fObservables[id].type
831 <<
", value to add is in type: " << obs.
type <<
", trying to update to the new type."
833 fObservableTypes[id] = obs.
type;
834 string name = fObservables[id].name;
835 fObservables[id].Destroy();
837 fObservables[id].name = name;
839 obs >> fObservables[id];
882 std::vector<string> cuts =
Split(cut,
"&&",
false,
true);
884 for (
auto& cut : cuts) {
900 const std::vector<string> validOperators = {
"==",
"<=",
">=",
"!=",
"=",
">",
"<"};
902 if (cut.find(
"&&") != string::npos)
return EvaluateCuts(cut);
904 string operation, observable;
906 for (
const auto& validOperator : validOperators) {
907 if (cut.find(validOperator) != string::npos) {
908 operation = validOperator;
909 observable = (string)cut.substr(0, cut.find(operation));
910 value = std::stod((
string)cut.substr(cut.find(operation) + operation.length(), string::npos));
915 if (operation.empty())
916 cout <<
"TRestAnalysisTree::EvaluateCut. Invalid operator in cut definition! " << cut << endl;
919 if (operation ==
"==" && value == val)
return true;
920 if (operation ==
"!=" && value != val)
return true;
921 if (operation ==
"<=" && val <= value)
return true;
922 if (operation ==
">=" && val >= value)
return true;
923 if (operation ==
"=" && val == value)
return true;
924 if (operation ==
">" && val > value)
return true;
925 if (operation ==
"<" && val < value)
return true;
935 const std::vector<string> validOperators = {
"==",
"<=",
">=",
"!=",
"=",
">",
"<"};
937 std::vector<string> cuts =
Split(cut_str,
"&&",
false,
true);
939 vector<string> obsNames;
940 for (
auto& cut : cuts) {
941 string operation, observable;
942 for (
const auto& validOperator : validOperators) {
943 if (cut.find(validOperator) != string::npos) {
944 obsNames.push_back((
string)cut.substr(0, cut.find(validOperator)));
956 for (
auto& obsName : obsNames) this->SetBranchStatus(obsName.c_str(),
true);
963 for (
auto& obsName : obsNames) this->SetBranchStatus(obsName.c_str(),
false);
997 RESTError <<
"TRestAnalysisTree::GetObservableIntegral. Observable not found! : " << obsName
1003 for (Int_t n = 0; n < TTree::GetEntries(); n++) {
1007 if (xLow != -1 && xHigh != -1 && (value < xLow || value > xHigh))
continue;
1022 RESTError <<
"TRestAnalysisTree::GetObservableAverage. Observable not found! : " << obsName
1029 for (Int_t n = 0; n < TTree::GetEntries(); n++) {
1033 if (xLow != -1 && xHigh != -1 && (value < xLow || value > xHigh))
continue;
1038 if (N <= 0)
return 0;
1054 for (Int_t n = 0; n < TTree::GetEntries(); n++) {
1058 if (xLow != -1 && xHigh != -1 && (value < xLow || value > xHigh))
continue;
1061 sum += (value - mean) * (value - mean);
1064 if (N <= 0)
return 0;
1066 return TMath::Sqrt(sum / N);
1077 RESTError <<
"TRestAnalysisTree::GetObservableMaximum. Observable not found! : " << obsName
1082 Double_t max = -DBL_MAX;
1083 for (Int_t n = 0; n < TTree::GetEntries(); n++) {
1087 if (xLow != -1 && xHigh != -1 && (value < xLow || value > xHigh))
continue;
1088 if (value > max) max = value;
1102 RESTError <<
"TRestAnalysisTree::GetObservableMinimum. Observable not found! : " << obsName
1107 Double_t min = DBL_MAX;
1108 for (Int_t n = 0; n < TTree::GetEntries(); n++) {
1112 if (xLow != -1 && xHigh != -1 && (value < xLow || value > xHigh))
continue;
1113 if (value < min) min = value;
1144 Double_t level, Int_t nBins, Double_t xLow, Double_t xHigh) {
1145 if (level > 1 || level < 0) {
1146 RESTWarning <<
"Level is : " << level << RESTendl;
1147 RESTWarning <<
"Level must be between 0 and 1" << RESTendl;
1151 Double_t integral = this->GetIntegral(obsWeight, xLow, xHigh);
1153 TString histDefinition = Form(
"hc(%5d,%lf,%lf)", nBins, xLow, xHigh);
1155 this->Draw(obsName +
">>hc", obsWeight);
1157 this->Draw(obsName +
">>" + histDefinition, obsWeight);
1159 TH1F* htemp = (TH1F*)gPad->GetPrimitive(
"hc");
1162 for (
int i = 0; i < htemp->GetNbinsX(); i++) {
1163 sum += htemp->GetBinContent(i + 1);
1165 if (sum > level * integral)
return htemp->GetBinCenter(i + 1);
1176 std::vector<std::string> names;
1178 auto branches = GetListOfBranches();
1179 for (
int i = 0; i < branches->GetEntries(); i++) {
1180 names.push_back((
string)branches->At(i)->GetName());
1190 TTree* tree =
new TTree();
1192 char* dest = (
char*)tree +
sizeof(TObject);
1193 char* from = (
char*)
this +
sizeof(TObject);
1195 constexpr size_t n =
sizeof(TTree) -
sizeof(TObject);
1198 char* temp = (
char*)malloc(n);
1199 memcpy(temp, dest, n);
1202 memcpy(dest, from, n);
1203 int result = tree->Write(name, option, bufsize);
1206 memcpy(dest, temp, n);
1219 auto file = std::unique_ptr<TFile>{TFile::Open(_file.c_str(),
"update")};
1220 if (!file->IsOpen()) {
1221 RESTWarning <<
"TRestAnalysisTree::AddChainFile(): failed to open file " << _file << RESTendl;
1225 if (this->GetRunOrigin() == 0) {
1230 if (tree !=
nullptr && tree->GetEntry(0)) {
1231 if (tree->GetEntry(0) > 0) {
1232 if (tree->GetRunOrigin() == this->GetRunOrigin()) {
1237 fChain =
new TChain(
"AnalysisTree",
"Chained AnalysisTree");
1238 fChain->Add(this->GetCurrentFile()->GetName());
1240 return fChain->Add(_file.c_str()) == 1;
1243 <<
"TRestAnalysisTree::AddChainFile(): invalid file, AnalysisTree in file has different "
1247 RESTWarning <<
"TRestAnalysisTree::AddChainFile(): invalid file, AnalysisTree in file is empty!"
1251 RESTWarning <<
"TRestAnalysisTree::AddChainFile(): invalid file, file does not contain an AnalysisTree!"
1264 return TTree::GetTree();
1277 return TTree::LoadTree(entry);
1279 return fChain->LoadTree(entry);
1285Long64_t TRestAnalysisTree::GetEntries()
const {
1287 return TTree::GetEntries();
1289 return fChain->GetEntries();
1292Long64_t TRestAnalysisTree::GetEntries(
const char* sel) {
1294 return TTree::GetEntries(sel);
1296 return fChain->GetEntries(sel);
1299TRestAnalysisTree::~TRestAnalysisTree() {
delete fSubEventTag; }
void SetValue(const T &val)
Set the value of the wrapped type.
std::string ToString()
Convert the wrapped object to std::string.
std::string type
Type of the wrapped object.
char * address
Address of the wrapped object.
bool is_data_type
Pointer to the corresponding TDataType helper, if the wrapped object is in data type.
std::string name
Name field.
bool IsZombie()
If this object type wrapper is invalid.
REST core data-saving helper based on TTree.
TString GetObservableDescription(Int_t n)
Get the observable description according to id.
void DisableQuickObservableValueSetting()
It will disable quick observable value setting.
std::vector< std::string > GetCutObservables(const std::string &cut_str)
It will return a list with the names found in a string with conditions, as given in methods as Evalua...
void UpdateObservables()
Update observables stored in the tree.
Double_t GetObservableContour(const TString &obsName, const TString &obsIndexer, Double_t level=0.5, Int_t nBins=-1, Double_t xLow=-1, Double_t xHigh=-1)
This method generates a histogram of the the observable obsName given in the argument weighting it wi...
void EnableAllBranches()
It will enable all branches in the tree.
void EnableQuickObservableValueSetting()
It will enable quick observable value setting.
Long64_t LoadTree(Long64_t entry)
Overrides TTree::LoadTree(), to set current tree according to the given entry number,...
Bool_t AddChainFile(const std::string &file)
Add a series output file like TChain.
TString GetObservableName(Int_t n)
Get the observable name according to id.
void UpdateBranches()
Update branches in the tree.
Double_t GetObservableIntegral(const TString &obsName, Double_t xLow=-1, Double_t xHigh=-1)
It returns the integral of the observable considering the given range. If no range is given the full ...
TChain * fChain
used for quick search of certain observables
Bool_t EvaluateCuts(const std::string &expression)
This method will receive a string with several analysis observables/cuts in the same fashion as used ...
TTree * GetTree() const
Overrides TTree::GetTree(), to get the actual tree used in case of chain operation(fCurrentTree !...
Double_t GetObservableMaximum(const TString &obsName, Double_t xLow=-1, Double_t xHigh=-1)
It returns the maximum value of obsName considering the given range. If no range is given the full hi...
Int_t GetObservableID(const std::string &obsName)
Get the index of the specified observable.
void MakeObservableIdMap()
Update the map of observable name to observable id.
Int_t GetMatchedObservableID(const std::string &obsName)
Get the index of the observable, erasing the prefix if exists.
Double_t GetObservableAverage(const TString &obsName, Double_t xLow=-1, Double_t xHigh=-1)
It returns the average of the observable considering the given range. If no range is given the full h...
void DisableBranches(std::vector< std::string > obsNames)
It will disable the branches given by argument.
Double_t GetObservableRMS(const TString &obsName, Double_t xLow=-1, Double_t xHigh=-1)
It returns the RMS of the observable considering the given range. If no range is given the full histo...
Double_t GetDblObservableValue(const std::string &obsName)
Get double value of the observable, according to the name.
TString GetObservableType(Int_t n)
Get the observable type according to id.
std::vector< std::string > GetObservableNames()
It returns a vector with strings containing all the observables that exist in the analysis tree.
void DisableAllBranches()
It will disable all branches in the tree.
Double_t GetObservableMinimum(const TString &obsName, Double_t xLow=-1, Double_t xHigh=-1)
It returns the minimum value of obsName considering the given range. If no range is given the full hi...
int EvaluateStatus()
Evaluate the Status of this tree.
Bool_t ObservableExists(const std::string &obsName)
Get if the specified observable exists.
Int_t fNObservables
in case multiple files for reading
void EnableBranches(std::vector< std::string > obsNames)
It will enable the branches given by argument.
Bool_t EvaluateCut(const std::string &expression)
This method will evaluate a condition on one analysis observable constructed as "observable>value"....
void SetObservable(Int_t id, RESTValue obs)
Set the value of observable whose id is as specified.
Int_t WriteAsTTree(const char *name=0, Int_t option=0, Int_t bufsize=0)
It writes TRestAnalysisTree as TTree, in order to migrate files to pure ROOT users.
A base class for any REST event.
TRestReflector WrapType(std::string typeName)
Wrap information an object of type: typeName, memory is not allocated.
TRestReflector Assembly(std::string typeName)
Assembly an object of type: typeName, returning the allocated memory address and size.
std::vector< std::string > Split(std::string in, std::string separator, bool allowBlankString=false, bool removeWhiteSpaces=false, int startPos=-1)
Split the input string according to the given separator. Returning a vector of fragments.
Int_t DiffString(const std::string &source, const std::string &target)
Returns the number of different characters between two strings.