Adding new classes for numerical debugging
[u/mrichter/AliRoot.git] / TPC / macros / AliXRDPROOFtoolkit.cxx
CommitLineData
db6fdd20 1/*
2 TTOOLKIT to acces files on XRD
3 WORKING ONLY AT GSI
4//
5
6 Example usage:
7 Load toolkit
8 gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros")
11f27151 9 gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
db6fdd20 10
11 1.
12 Retrieve the list of files : POSSIBLE ONLY FOR USER WITH LOGIN ACCESS TO THE XRD MACHINES
13
14 AliXRDPROOFtoolkit tool;
11f27151 15 tool.ListOfFiles("all.txt","/data.local2/sma/sim/v4-06-Rev-03/pp*", "AliESDs.root", kFALSE);
16 tool.ListOfFiles("pp.txt","/data.local2/sma/sim/v4-06-Rev-03/pp", "AliESDs.root", kFALSE);
17
18 tool.ListOfFiles("pp64.txt","/data.local2/sma/sim/v4-06-Rev-03/pp64", "AliESDs.root", kFALSE);
19 tool.ListOfFiles("pp64m.txt","/data.local2/sma/sim/v4-06-Rev-03/pp64", "AliESDs.root", kTRUE);
18519053 20
21 // check the list
11f27151 22 AliXRDPROOFtoolkit::FilterList("pp.txt","AliESDs.root esdTree AliESDfriends.root * Kinematics.root *",0)
23 AliXRDPROOFtoolkit::FilterList("pp.txt","AliESDs.root esdTree AliESDfriends.root * Kinematics.root *",1)
24
db6fdd20 25 2.
26
27 AliXRDPROOFtoolkit tool;
11f27151 28 TChain * chain = tool.MakeChain("pp.txt","esdTree",0,10)
29 chain->Draw("fTPCnclsF");
db6fdd20 30
31
32 3. Process logs - ONLY priority users - with ssh acces
33 AliXRDPROOFtoolkit tool;
34 tool.FilterSegFault();
35 TTree * treeSys = tool.DumpSys(kTRUE)
36
37*/
38
39
40#include <TTree.h>
41#include <TString.h>
42#include <TObjArray.h>
43#include <TObjString.h>
44#include <TTree.h>
45#include <TFile.h>
46#include <TChain.h>
47#include <TDSet.h>
48#include <TH1.h>
49#include <TGraph.h>
50#include <TMath.h>
51#include <TPad.h>
52#include <exception>
53#include <fstream>
54#include <TRandom.h>
55
56
57#include <AliXRDPROOFtoolkit.h>
58
59
60ClassImp(AliXRDPROOFtoolkit);
61
62
63
64//______________________________________________________________________________
65AliXRDPROOFtoolkit::AliXRDPROOFtoolkit () : TObject ()
66{
67 //
68 // Default -GSI specific setup
69 //
11f27151 70 for(Int_t i=255;i<269;i++)
71 //for(Int_t i=259;i<260;i++)
db6fdd20 72 listeMachine.push_back(new TString(Form("lxb%d.gsi.de", i)));
73 fUserGroup = gSystem->GetUserInfo();
74 fUserName = fUserGroup->fUser;
75 fVerbose=1;
76}
77
78void AliXRDPROOFtoolkit::Print(Option_t* /*option*/) const{
79 //
80 // Print current setup of toolkit
81 //
82 printf("User name\t%s\n", fUserName.Data());
83 printf("List of slaves\n");
84
85 for(UInt_t i=0;i<listeMachine.size();i++)
86 printf("%s\n",listeMachine[i]->Data());
87}
88
89
90//______________________________________________________________________________
91void AliXRDPROOFtoolkit::AddMachine (const char*name)
92{
93 //
94 // add computer to the list
95 //
96 listeMachine.push_back( new TString(name));
97}
98
99
100//______________________________________________________________________________
101Bool_t AliXRDPROOFtoolkit::ListOfFiles(const char*fileName, const char*path, const char*filter, Bool_t displayMachine)
102{
103 //
104 // Get the list of files on "registerd slaves"
105 //
18519053 106 // fileName - Resultinfg file with list
db6fdd20 107 // path - starting path on slave e.g /data.local2/sma/
108 // filter - filter expression e.g. AliESDs.root
109 // display machine - not used yet
110
111 char filterXRD[100];
112 char command[1000];
113 //
114 // FILTER expression - to get REDIRECTOR NAME
115 //
116 //what we want for sed
117 // sprintf(filterXRD,"sed s/\\/data.local2/root:\\/\\/gsiaf.gsi.de:1094\\//");
118 //what we should write
119 sprintf(filterXRD,"sed s/\\\\/data.local2/root:\\\\/\\\\/gsiaf.gsi.de:1094\\\\//");
120 //
121 //
122 //
123 gSystem->Exec(Form("echo >%s",fileName));
124 for(UInt_t i=0; i<listeMachine.size(); i++){
18519053 125 if (displayMachine){
11f27151 126 sprintf(filterXRD,"sed s/\\\\/data.local2/root:\\\\/\\\\/%s:1094\\\\//",listeMachine[i]->Data());
18519053 127 }
db6fdd20 128 cout<<"Inspecting "<<listeMachine[i]->Data()<<" ..."<<endl;
129 sprintf(command,"lsrun -m %s find %s | grep %s | %s >> %s", listeMachine[i]->Data(), path, filter, filterXRD,fileName);
130 printf(command);
131 gSystem->Exec(command);
132 }
133 return kTRUE;
134}
135
136
db6fdd20 137TChain* AliXRDPROOFtoolkit::MakeChain(const char*fileIn, const char * treeName, const char *fName, Int_t maxFiles, Int_t startFile)
138{
139 //
140 // Create the chain
141 //
142 TChain* chain = new TChain(treeName);
143
144 // Open the input stream
145 ifstream in;
146 in.open(fileIn);
147
148 // Read the input list of files and add them to the chain
149 TString currentFile;
150 Int_t counter=0;
151 while(in.good()) {
152 in >> currentFile;
153 if (fName) {
154 currentFile+="#";
155 currentFile+=fName;
156 }
157 if (!currentFile.Contains("root")) continue; // protection
158 counter++;
159 if (counter<startFile) continue;
160 if (counter>maxFiles+startFile) break;
161 chain->Add(currentFile.Data());
162 }
163
164 in.close();
165
166 return chain;
167}
168
169TChain* AliXRDPROOFtoolkit::MakeChainRandom(const char*fileIn, const char * treeName,const char *fName, Int_t maxFiles, Int_t startFile)
170{
171 //
172 // Create a TDSet - files are in random order
173 //
174 // filein - input list text file
175 // treename - containg tree
176 // maxFiles - maximum number of files included
177
178 TObjArray array(10000);
179
180 TChain* chain = new TChain(treeName);
181
182 // Open the input stream
183 ifstream in;
184 in.open(fileIn);
185
186 // Read the input list of files and add them to the chain
187 TString currentFile;
188 Int_t counter=0;
189 while(in.good()) {
190 in >> currentFile;
191 if (fName) {
192 currentFile+="#";
193 currentFile+=fName;
194 }
195 if (!currentFile.Contains("root")) continue; // protection
196 counter++;
197 // chain->Add(currentFile.Data());
198 array.AddLast(new TObjString(currentFile));
199 }
200 in.close();
201 Int_t entries = array.GetEntries();
202 printf("Number of entries\t%d",entries);
203 if (maxFiles<0) maxFiles=entries;
204 if (maxFiles>entries) maxFiles=entries;
205 //
206 //
207 //
208 for (Int_t i=0; i<maxFiles; i++){
209 Int_t ifile = TMath::Nint(gRandom->Rndm()*Float_t(entries));
210 if (ifile<entries && (array.At(ifile)) && array.At(ifile)->TestBit(TObject::kCannotPick)==kFALSE){
211 printf("%d\t%d\t%s\n",i, ifile, array.At(ifile)->GetName());
212 chain->Add(array.At(ifile)->GetName());
213 array.At(ifile)->SetBit(TObject::kCannotPick);
214 }
215 }
216 return chain;
217}
218
219
220
221TDSet* AliXRDPROOFtoolkit::MakeSet(const char*fileIn, const char * treeName, const char *fName, Int_t maxFiles)
222{
223 //
224 // Create the TDSet out of list
225 // filein - input list text file
226 // treename - containg tree
227 // maxFiles - maximum number of files included
228
229 TDSet* chain = new TDSet(treeName);
230
231 // Open the input stream
232 ifstream in;
233 in.open(fileIn);
234
235 // Read the input list of files and add them to the chain
236 TString currentFile;
237 Int_t counter=0;
238 while(in.good()) {
239 in >> currentFile;
240 if (fName) {
241 currentFile+="#";
242 currentFile+=fName;
243 }
244 if (!currentFile.Contains("root")) continue; // protection
245 counter++;
246 if (maxFiles>0 && counter>maxFiles) break;
247 chain->Add(currentFile.Data());
248 }
249
250 in.close();
251 chain->Validate();
252 return chain;
253}
254
255
256TDSet* AliXRDPROOFtoolkit::MakeSetRandom(const char*fileIn, const char * treeName, const char *fName, Int_t maxFiles)
257{
258 //
259 // Create a TDSet - files are in random order
260 //
261 // filein - input list text file
262 // treename - containg tree
263 // maxFiles - maximum number of files included
264
265 TObjArray array(10000);
266
267 TDSet* chain = new TDSet(treeName);
268
269 // Open the input stream
270 ifstream in;
271 in.open(fileIn);
272
273 // Read the input list of files and add them to the chain
274 TString currentFile;
275 Int_t counter=0;
276 while(in.good()) {
277 in >> currentFile;
278 if (fName) {
279 currentFile+="#";
280 currentFile+=fName;
281 }
282 if (!currentFile.Contains("root")) continue; // protection
283 counter++;
284 // chain->Add(currentFile.Data());
285 array.AddLast(new TObjString(currentFile));
286 }
287 in.close();
288 Int_t entries = array.GetEntries();
289 printf("Number of entries\t%d",entries);
290 if (maxFiles<0) maxFiles=entries;
291 if (maxFiles>entries) maxFiles=entries;
292 for (Int_t i=0; i<maxFiles; i++){
293 Int_t ifile = TMath::Nint(gRandom->Rndm()*Float_t(entries));
294 if (ifile<entries && (array.At(ifile)) && array.At(ifile)->TestBit(TObject::kCannotPick)==kFALSE){
295 printf("%d\t%d\t%s\n",i, ifile, array.At(ifile)->GetName());
296 chain->Add(array.At(ifile)->GetName());
297 array.At(ifile)->SetBit(TObject::kCannotPick);
298 }
299 }
300
301
302 chain->Validate();
303 return chain;
304}
305
306//_______________________________________________________________________________
307
308
309void AliXRDPROOFtoolkit::FilterSegFault(const char *filter){
310 //
311 // Print the list of slaves finished with seg fault
312 //
313 printf("List of the PROOF slaves with seg fault (Last session) \n");
314 for(UInt_t i=0; i<listeMachine.size(); i++){
315 if (HasSegFault(listeMachine[i]->Data(), filter)){
316 printf("%s\n",listeMachine[i]->Data());
317 }
318 }
319}
320
321//_______________________________________________________________________________
322
323Bool_t AliXRDPROOFtoolkit::HasSegFault(const char * machine, const char *filter){
324 //
325 // check if segmentation fault on the node
326 //
327 char command0[1000];
328 char command[1000];
329 char *path = "segfault.log";
330 Long_t id,size,flags,modtime;
331
332 // first check if we have a log file
333 sprintf(command0, Form("lsrun -m %s find /data.local2/proof/%s/ | grep %s | grep .log >filelist.list", machine,fUserName.Data(), filter));
334 if (fVerbose>1) {
335 printf("%s\n",command0);
336 }
337 gSystem->Exec(command0);
338 gSystem->GetPathInfo("filelist.list", &id, &size, &flags, &modtime);
339 if (size<1) return kFALSE;
340
341 //
342 // now check the content
343 //
344 sprintf(command, Form("lsrun -m %s cat `lsrun -m %s find /data.local2/proof/%s/ | grep %s|grep log ` | grep segmentation >segfault.log", machine, machine,fUserName.Data(), filter));
345
346 if (fVerbose) {
347 printf("%s\n",command);
348 }
349 if (fVerbose>1) gSystem->Exec(command);
350 gSystem->GetPathInfo(path, &id, &size, &flags, &modtime);
351 return (size>10);
352}
353
354
355//--------------------------------------------------------------------
356
357TTree * AliXRDPROOFtoolkit::DumpSys(Bool_t verbose){
358 //
359 // Dump memory usage on worker nodes
360 gSystem->Exec("echo > syswatch.log");
361 for(UInt_t i=0; i<listeMachine.size(); i++){
362 if (verbose) gSystem->Exec(Form("ssh %s cat /data.local2/proof/miranov/last-worker*/syswatch.log ",listeMachine[i]->Data()));
363 gSystem->Exec(Form("ssh %s cat /data.local2/proof/miranov/last-worker*/syswatch.log >> syswatch.log",listeMachine[i]->Data()));
364 }
365
366 TTree * tree = new TTree("asci","asci");
367 tree->SetDirectory(0);
368 // tree->ReadFile("syswatch.log","hname/C:fname/C:entry/I:time/I:mem0/F:mem1/F:mem2/F:mem3/F");
369 tree->ReadFile("syswatch.log","hname/C:fname/C:entry/I:time/I:mem0/F:mem1/F:mem2/F:mem3/F:cpu0/F:cpu1/F:cpu2/F:cpu3/F");
370 return tree;
371}
372
373// //--------------------------------------------------------------------
374
375TTree * AliXRDPROOFtoolkit::DumpSys2(Bool_t verbose){
376 //
377 // Dump memory usage on worker nodes
378 //
379 gSystem->Exec("echo > syswatch.log");
380 for(UInt_t i=0; i<listeMachine.size(); i++){
381 if (verbose)
382 gSystem->Exec(Form("lsrun -m %s cat /data.local2/proof/miranov/last-worker*/syswatch.log ",listeMachine[i]->Data()));
383 gSystem->Exec(Form("lsrun -m %s cat /data.local2/proof/miranov/last-workersession/syswatch.log >> syswatch.log",listeMachine[i]->Data()));
384 }
385
386 TTree * tree = new TTree("asci","asci");
387 tree->SetDirectory(0);
388 // tree->ReadFile("syswatch.log","hname/C:fname/C:entry/I:time/I:mem0/F:mem1/F:mem2/F:mem3/F");
389 tree->ReadFile("syswatch.log","hname/C:fname/C:entry/I:time/I:mem0/F:mem1/F:mem2/F:mem3/F:cpu0/F:cpu1/F:cpu2/F:cpu3/F");
390 return tree;
391}
392
393
394
395
396//
397
398
399TTree* AliXRDPROOFtoolkit::DumpFiles(Bool_t verbose){
400 //
401 //
402 //
403 gSystem->Exec("touch filewatch.log");
404 for(UInt_t i=0; i<listeMachine.size(); i++){
405 if (verbose) gSystem->Exec(Form("ssh %s cat /data.local2/proof/miranov/last-worker*/worker*/filewatch.log >>filewatch.log",listeMachine[i]->Data()));
406 gSystem->Exec(Form("ssh %s cat /data.local2/proof/miranov/last-worker*/worker*/filewatch.log >>filewatch.log",listeMachine[i]->Data()));
407 }
408 TTree * tree = new TTree("asci","asci");
409 tree->SetDirectory(0);
410 tree->ReadFile("filewatch.log","hname/C:fname/C:entry/I:status/I");
411 return tree;
412}
413
414
415
416
417
db6fdd20 418
419//______________________________________________________________________________
420void AliXRDPROOFtoolkit::CheckFiles (const char*fileIn, UInt_t checkLevel, const char*treeToRetrieve, const char*varexp, const char*selection)
421{
422 //
423 // check the files
424 //
425 fstream fic;
426 fic.open(fileIn, ios_base::in);
427 fstream focGood;
428 fstream focBad;
429 focGood.open(Form("%s.Good",fileIn), ios_base::out|ios_base::trunc);
430 focBad.open(Form("%s.Bad",fileIn), ios_base::out|ios_base::trunc);
431 //
432 if(!fic.is_open()) {
433 cout<<"Can't open file "<<fileIn<<endl;
434 return;
435 }
436 //
437 //
438 //
439 Long64_t size;
440 char buffer[256];
441 char * line;
442 char * machine;
443 Int_t level=0;
444 Float_t compressionFactor;
445 Int_t nkey;
446 Int_t version;
447 TObjString * fileName=0x0;
448 TObjString * machineName=0x0;
449 // TChain chain ("check_chain");
450
451 TFile fout(Form("%s.root",fileIn),"recreate");
452 TTree * tree=new TTree("stats", "stats of AliXRDPROOFtoolkit::CheckFiles function");
453
454 tree->Branch ("machine", "TObjString", &machineName, 256000,0);
455 tree->Branch ("file", "TObjString", &fileName, 256000,0);
456 tree->Branch ("level", &level, "level/I");
457 tree->Branch ("size", &size, "size/L");
458 tree->Branch ("nkey", &nkey, "nkey/I");
459 tree->Branch ("compress", &compressionFactor, "compress/F");
460 tree->Branch ("version", &version, "version/I");
461
462 // start loop over the files
463 fic.getline(buffer, sizeof(buffer));
464 while (fic.good()){
465
466 // get the machine name if present in the file
467 machine=strchr(buffer, '\t');
468 if(machine!=0x0){
469 machine[0]='\0';
470 line=machine+1;
471 machine=buffer;
472 machineName=new TObjString(machine);
473 }else {
474 machineName=new TObjString("x");
475 line=buffer;
476 }
477 cout<<"Inspecting file :"<<line<<endl;
478
479
480 TTree * getTree=0x0;
481 fileName=new TObjString(line);
482
483 TFile * f=TFile::Open(line);
484 // chain.AddFile(line);
485 level=0;
486 size=-1;
487 nkey=-1;
488 compressionFactor=-1;
489 version=-1;
490
491 if (fileName->String().Contains("AliESDs.root")){
492 //
493 // check friend file
494 //
495 char fnameFriend[1000];
496 sprintf(fnameFriend,"%s/AliESDfriends.root",gSystem->DirName(fileName->String().Data()));
497 cout<<"Inspecting file :"<<fnameFriend<<endl;
498 TFile * ffriend=TFile::Open(fnameFriend);
499 if (!ffriend) level=-4;
500 else{
501 if (ffriend->IsZombie()) level=-3;
502 if (ffriend->TestBit(TFile::kRecovered) || ffriend->TestBit(TFile::kWriteError)){
503 level=-2;
504 }
505 ffriend->Close();
506 delete ffriend;
507 }
508 }
509
510
511 if(level>=-1 && f!=0x0){
512 level=1;
513 size=f->GetSize();
514 nkey=f->GetNkeys();
515 compressionFactor=f->GetCompressionFactor();
516 version=f->GetVersion();
517
518 if(checkLevel>0 && !f->IsZombie()){
519 level=2;
520 if(checkLevel>1 && treeToRetrieve!="" && (getTree=(TTree*)f->Get(treeToRetrieve))!=0x0){
521 level=3;
522 Int_t tentries = getTree->GetEntries();
523 if (tentries>=0) level=4;
524 cout<<"Number of entries :"<<getTree->GetEntries()<<endl;
525
526 if(checkLevel>3 && varexp!="" &&tentries>0) {
527 getTree->SetBranchStatus("*",1);
528 try{
529 TH1F his("his","his",100,-1,1);
530 Int_t selected = getTree->Draw(Form("%s>>his",varexp), selection, "goff", 1, tentries-1);
531 cout<<"Selected\t"<<selected<<endl;
532 if(selected>-1){
533 level=5;
534
535 //try to remove the created histogrames ...
536// TH1F *htemp = (TH1F*)gPad->GetPrimitive("htemp"); // 1D
537// TGraph *graph = (TGraph*)gPad->GetPrimitive("Graph"); // 2D
538// if(htemp!=0x0) {cout<<"removing TH1D"<<endl; delete htemp;}
539// else if(graph!=0x0) {cout<<"removing TGraph"<<endl; delete graph;}
540// else cout<<"nothing to remove : memory leak ..."<<endl;
541
542 }
543 }catch(std::bad_alloc){
544 cout<<"Warning : Draw option send std::badalloc"<<endl;
545 }
546 }
547 delete getTree;
548 }
549 }
550 f->Close();
551 delete f;
552 }
553 if (level>checkLevel){
554 focGood<<line<<endl;
555 }
556 else{
557 focBad<<line<<"\t"<<level<<endl;
558 }
559
560
561 tree->Fill();
562 fic.getline(buffer, sizeof(buffer));
563 }
564
565 //now use chain to check
566 //chain.Lookup(kTRUE);
567
568
569 // Save the tree
570 tree->Write();
571 fout.Close();
572 focGood.close();
573 focBad.close();
0034e139 574
db6fdd20 575}
576
18519053 577Int_t AliXRDPROOFtoolkit::CheckTreeInFile(const char*fileName,const char*treeName, Int_t debugLevel, const char *branchName){
578 //
579 // Check the tree in file
580 // fileName - the name of the file with tree
581 // treeName - the name of file
582 // debugLevel - 0 check the existance of the file - 1 make loop over entries
583 // branchName - if debugLevel>0 the branch is chcecked
584 // if brnachName =0 the content of full tree is chcecked
585 // return value = 0 - Check things OK
586 // -1 - file not exist or not accesible
587 // -2 - file is zombie
588 // -3 - tree not present
589 // -4 - branch not present
590 TFile * file = TFile::Open(fileName);
11f27151 591 if (!file) { return -1;}
592 if (file->IsZombie()) {file->Close(); delete file; return -2;};
593
594 TString TrName(treeName);
595 if (TrName=="*") {
596 //cout <<" treename ==== *"<<endl;;
597 file->Close(); delete file;
598 return 0;
599 }
18519053 600 TTree * tree = (TTree*)file->Get(treeName);
11f27151 601 if (!tree) {file->Close(); delete file; return -3;}
18519053 602 TBranch * branch = 0;
603 if (branchName) {
604 branch = tree->GetBranch(branchName);
11f27151 605 if (!branch) {file->Close(); delete file; return -4;}
18519053 606 }
607 //
608 tree->SetBranchStatus("*",1);
609 try {
610 if (debugLevel>0){
611 Int_t entries = tree->GetEntries();
612 for (Int_t i=0;i<entries; i++){
613 if (branch) branch->GetEntry(i);
614 else tree->GetEntry();
615 }
616 }
617 }catch ( ... ) {
618 printf("PROBLEM\n");
619 // never catched - as there is no exception in the ROOT IO
11f27151 620 file->Close(); delete file;
18519053 621 return 1 ;
622 }
623
11f27151 624 file->Close(); delete file;
18519053 625 return 0;
626}
627
628
629Bool_t AliXRDPROOFtoolkit::FilterList(const char*inputList, const char*fileList, Int_t checkLevel){
630 //
631 // Filter the list
632 // inputList - list of original file names
633 // fileList - list of file to be checked
634 // - 0 - fileName
635 // - 1 - treeName (if * not checked)
636 // - 2 - fileName
637 // ....
638 // checkLevel - 0 - check only existance of the files and tree's +
639 // simple file corruption
640 // > 1 - check the content of the tree -
641 // (can crash as there do not exest exception handling in ROOT)
642 // Output - two streams are created - file with good entries
643 // "%s.Good a,d file with bad entries %s.Bad
644 //EXAMPLE:
645 // AliXRDPROOFtoolkit::FilterList("ppgrid2.txt","AliESDs.root esdTree AliESDfriends.root * Kinematics.root *",1)
646
647 fstream finput;
648 finput.open(inputList, ios_base::in);
649 fstream focGood;
650 fstream focBad;
651 focGood.open(Form("%s.Good",inputList), ios_base::out|ios_base::trunc);
652 focBad.open(Form("%s.Bad",inputList), ios_base::out|ios_base::trunc);
653 //
654 if(!finput.is_open()) {
655 cout<<"Can't open file "<<inputList<<endl;
656 return kFALSE;
657 }
658 //
659 // Read the input list of files and add them to the chain
660 //
661 TObjArray *array = (TString(fileList)).Tokenize(" ");
662 TString currentFile;
663 Int_t counter=0;
664 while(finput.good()) {
665 finput >> currentFile;
666 if (!currentFile.Contains("root")) continue; // protection
667 // Bool_t isZip = currentFile.Contains("#");
668 const char * dirname = gSystem->DirName(currentFile.Data());
669 Int_t status = 0;
670 for (Int_t i=0; i<array->GetEntries(); i+=2){
671 char fname[1000];
672 //if (isZip) sprintf(fname,
673 sprintf(fname, "%s/%s",dirname,array->At(i)->GetName());
11f27151 674 printf("\nFile to be checked %s/%s",dirname,array->At(i)->GetName());
675 //cout <<"\n arguments: "<< array->At(i+1)->GetName()<<" "<<checkLevel<<endl;
18519053 676 Int_t cstatus = CheckTreeInFile(fname, array->At(i+1)->GetName(), checkLevel,0);
11f27151 677 //printf(" CheckTreeInFile returns %d",cstatus);
18519053 678 if (cstatus!=0) {
679 status = cstatus;
680 break;
681 }
682 }
683 if (status==0){
684 focGood<<currentFile<<endl;
685 }else{
686 focBad<<currentFile<<endl;
687 }
688 counter++;
689 }
690 finput.close();
691}
692
693
694
db6fdd20 695
696
0034e139 697Bool_t AliXRDPROOFtoolkit::XRDCopyDir(const char * idir, const char * files, const char *odir, Bool_t zip){
698 //
699 // idir - input directory
700 // odir - output directory
701 // files - the list of files to be coppied
702 // zip - not supported yet
703 //
704 // Example :
705 //
706 // idir ="root://gsiaf.gsi.de:1094//sma/sim/v4-05-Rev-03/pp/0000";
707 // odir ="root://lxgrid2.gsi.de:1094//miranov/test/pp/0000";
708 // char *files="AliESDs.root AliESDfriend.root Kinematics.root";
709 TString str(files);
710 TObjArray * array = str.Tokenize(" ");
711 Int_t nfiles = array->GetEntries();
712 char infile[1000];
713 char outfile[1000];
0034e139 714 Bool_t succes=kTRUE;
715 for (Int_t ifile =0; ifile<nfiles; ifile++){
716 sprintf(infile,"%s/%s", idir, array->At(ifile)->GetName());
717 sprintf(outfile,"%s/%s", odir, array->At(ifile)->GetName());
718 printf("%s - %s\n",infile, outfile);
719 Bool_t result = TFile::Cp(infile,outfile);
720 succes &= result;
721 }
722 return succes;
723}
724
725
db6fdd20 726
727