Merging files

Dear all,
I am trying to merge a large number of output files, stored in the following Alien directory:
/alice/cern.ch/user/m/mleoncin/LHC10f6a/output
The problem is that I have to merge more than 20000 files (coming from an MC analysis). I’ve tried using the following code but it is too slow. I’ve also tried the plugin->SetMergeViaJDL(); but it doesn’t work.
Can you give me some advice please?
Thank you very much,
Marco

[code]void mergeHistoNtuples_alien(const char* path = “/alice/cern.ch/user/m/mleoncin/LHC10f6a/output/”,

	       const char * pattern = "LHC10f6a.root",

	       const char* mergedfile = "Totale.root"){

TGrid::Connect(“alien://”);

//cout<<"…connected to alien…"<<endl;

gSystem->Load(“libVMC.so”);

TGridResult* result = gGrid->Query(path,pattern);

result->Print();

Int_t i = 0;

// TList *outList = new TList;

//TH1F *outfHistEvents = new TH1F(“outfHistEvents”,“Processed Events; N_{events};counts”, 2,0.,2.);

TFileMerger *fm = new TFileMerger(kFALSE);

fm->SetFastMethod(kTRUE);

fm->OutputFile(mergedfile);

while(result->GetKey(i,“turl”)){

TFile *iFile = TFile::Open(result->GetKey(i,"turl"),"READ");

cout<< i << " open file: " << result->GetKey(i,"turl") << endl;

fm->AddFile(result->GetKey(i,"turl"));

/*

TList * iList = (TList*)iFile->Get("output");



TNtuple *iNtuple;

iNtuple = (TNtuple*)(iList->FindObject("Ntuple"));

outList->Add(iNtuple);



TH1F *infHistEvents;    

infHistEvents = (TH1F*)(iList->FindObject("fHistEvents")); 



outfHistEvents->Add(infHistEvents);

iFile->Close();

iFile=0;

*/

i++;  

//  if(i==3) break;

}

fm->Merge();

/*

TFile* mergedf = TFile::Open(mergedfile, “RECREATE”);

outNtuple->Merge(outList);

outNtuple->Write();

outfHistEvents->Write();

mergedf->Close();

*/

printf("*** Mandi! ***\n");

}

[/code]

Hi,

Can you try with hadd instead?

Philippe.