33 #include "Riostream.h" 40 #include "TFriendElement.h" 42 #include "TTreeFormula.h" 43 #include "TTreeFormulaManager.h" 55 TTree *treeLogbook = info.
GetTree(
"Logbook",
"LHC15o",
"cpass1_pass1",
"QA.TPC;QA.TRD;QA.TOF;");
56 TTree *treeTPC = info.
GetTree(
"QA.TPC",
"LHC15o",
"cpass1_pass1",
"QA.TRD;QA.TPC;QA.TOF;QA.TOF;Logbook");
57 TTree *treeTRD = info.
GetTree(
"QA.TRD",
"LHC15o",
"cpass1_pass1",
"QA.TPC;QA.TRD;QA.TOF;Logbook;");
73 testTree= info.
GetTree(
"Logbook",
"LHC15o",
"cpass1_pass1",
"QA.TPC;QA.TRD;QA.TOF;");
75 ::Error(
"AliTreePlayerTest.testSelectMetadata",
"Input not available");
80 Int_t statAll, stat0, stat1;
82 statAll=array->GetEntries();
84 stat0=array->GetEntries();
86 stat1=array->GetEntries();
87 if (statAll!=stat0+stat1 || statAll==0){
88 ::Error(
"AliTreePlayerTest.testSelectMetadata AND invariant",
"Test ERROR: N(Logbook&&(Stat))!=N(Logbook&&(Stat&&Base))+N(Logbook&&(Stat&&(!Base))) ");
90 ::Info(
"AliTreePlayerTest.testSelectMetadata AND invariant",
"Test OK: N(Logbook&&(Stat))=N(Logbook&&(Stat&&Base))+N(Logbook&&(Stat&&(!Base)))\t %d=%d+%d",statAll,stat0,stat1);
95 if (stat2b_0!=stat2b_1){
96 ::Error(
"AliTreePlayerTest.testSelectMetadata Negatioation test",
"Test ERROR: N(!(A||B))!=N((!A)&&(!B)) ");
98 ::Info(
"AliTreePlayerTest.testSelectMetadata Negatioation test",
"Test OK: N(!(A||B))=N((!A)&&(!B)) %d==%d",stat2b_0,stat2b_1);
109 if (stat2a_0!=stat2a_1+stat2a_2){
110 ::Error(
"AliTreePlayerTest.testselectTreeInfo",
"Test ERROR: N(A))!=N(A&&B)&&N(A&&!B)) ");
112 ::Info(
"AliTreePlayerTest.testselectTreeInfo",
"Test OK: N(A))==N(A&&B)&&N(A&&!B)) %d=%d+%d",stat2a_0,stat2a_1,stat2a_2);
130 TTree * treeTRD0 = info.
GetTree(
"QA.TRD",
"LHC15o",
"cpass1_pass1",
"QA.TRD;Logbook;");
131 TTree * treeTRD = info.
GetTree(
"QA.TRD",
"LHC15o",
"cpass1_pass1",
"QA.TPC;QA.TRD;QA.TOF;Logbook;MonALISA.RCT");
132 TTree * treeTPC = info.
GetTree(
"QA.TPC",
"LHC15o",
"cpass1_pass1",
"QA.TPC;QA.TRD;QA.TOF;Logbook;MonALISA.RCT");
136 what0+=
"Entry$:QA.TRD.run:QA.TPC.run:Logbook.run:Logbook.LHCperiod:QA.TPC.pass.GetName():QA.TPC.bz:Logbook.totalEventsPhysics:";
152 TTree *treeTPC = info.
GetTree(
"QA.TPC",
"LHC15o",
"cpass1_pass1");
153 TTree *treeTRD = info.
GetTree(
"QA.TRD",
"LHC15o",
"cpass1_pass1");
154 TTree *treeTRD2 = info.
GetTree(
"QA.TRD",
"LHC15o",
"cpass1_pass1");
156 treeTPC->BuildIndex(
"run");
157 treeTRD->BuildIndex(
"run");
158 treeTRD->AddFriend(treeTRD2,
"QA.TRD");
159 treeTRD->AddFriend(treeTPC,
"QA.TPC");
164 Int_t mismatch0 = (gSystem->GetFromPipe(
" cat sparsetest.csv | grep -v \"run\" | gawk '{ sum+=($1!=$2) } END {print sum} '")).Atoi();
166 Int_t mismatch1=(gSystem->GetFromPipe(
"cat sparsetest.csv | grep -v \"run\" | gawk '{sum+=($1==prev); prev=$1;} END {print sum} '")).Atoi();
167 if (mismatch0>0||mismatch1){
168 ::Error(
"AliTreePlayerTest.testConvertTree",
"Test ERROR Run mismatch for sparse trees");
170 ::Info(
"AliTreePlayerTest.testConvertTree",
"Test OK");
185 for (Int_t irun=0; irun<nruns;irun++) {
186 (*pcstream)<<
"runAll"<<
"run="<<irun<<
"\n";
187 if (irun%2==0) (*pcstream)<<
"run2"<<
"run="<<irun<<
"\n";
188 if (irun%3==0) (*pcstream)<<
"run3"<<
"run="<<irun<<
"\n";
189 if (irun%4==0) (*pcstream)<<
"run4"<<
"run="<<irun<<
"\n";
190 if (gRandom->Rndm()<0.5) (*pcstream)<<
"runR05"<<
"run="<<irun<<
"\n";
194 TList * tlist = pcstream->
GetFile()->GetListOfKeys();
195 TTree *
tree = (TTree*)pcstream->
GetFile()->Get(tlist->At(0)->GetName());
196 tree->BuildIndex(
"run");
197 TTree * treeR = (TTree*)pcstream->
GetFile()->Get(
"runR05");
198 treeR->BuildIndex(
"run");
199 for (Int_t ikey=0; ikey<=tlist->GetLast(); ikey++) {
200 TTree *treeF = (TTree*)pcstream->
GetFile()->Get(tlist->At(ikey)->GetName());
201 treeF->BuildIndex(
"run");
202 tree->AddFriend(treeF, tlist->At(ikey)->GetName());
203 treeR->AddFriend(treeF, tlist->At(ikey)->GetName());
205 printf(
"printed entries should be unioue per row and the same within the row or not defined (in case of sparse)");
206 treeR->Scan(
"run:run2.run:run3.run:run4.run:runR05.run",
"",
"",20);
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
static TObjArray * selectTreeInfo(TTree *tree, TString query, Int_t verbose)
TTreeSRedirector * pcstream
TTree * testTree
test of AliTreePlayer class
static TObjArray * selectMetadata(TTree *tree, TString query, Int_t verbose, TString *idList=NULL)
TTree * GetTree(TString type, TString period, TString pass, Int_t buildIndex=1)
static Int_t selectWhatWhereOrderBy(TTree *tree, TString what, TString where, TString orderBy, Int_t firstentry, Int_t nentries, TString outputFormat, TString outputName)
void reproduceIndexProblem()
This class gives you an interface to different trees of information spread throughout ALICE...
void testselectTreeInfo()
void testSelectMetadata()
void testselectWhatWhereOrderByForTRD()